unknown
2023-11-07 31cb0c2647468edf9205a74a18bb5680ed760fa6
web苏州:1管片发运计划提交.2样式问题修改
已修改6个文件
1810 ■■■■■ 文件已修改
web/src/api/modules/ductRaw.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/components/element/Pagination.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/DuctpiecePLM/PlanManage/DuctForward.vue 551 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/MaterialsIndex/components/embedded/Income.vue 736 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/MaterialsIndex/components/embedded/Type.vue 486 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/ProjectManage/SectionManage.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/api/modules/ductRaw.js
@@ -62,7 +62,29 @@
    //获取管片明细
    searchDuctDetails: params =>
        axios.post('/materials/needYear/selectPipeInfo', params),
    /**
     * 管片发运计划
    */
    ductForward: {
        // 查询管片生产计划信息
        searchDuctPlan: params =>
            axios.post('/materials/pipeoutplan/findAll', params),
        // 添加管片生产计划信息
        insertDuctPlan: params =>
            axios.post('/materials/pipeoutplan/insert', params),
        // 修改管片生产计划信息
        updateDuctPlan: params =>
            axios.post('/materials/pipeoutplan/update', params),
        // 删除管片生产计划信息
        deleteDuctPlan: params =>
         axios.get('/materials/pipeoutplan/delete', {params}),
        //获取月份列表
        getMonthsList: params =>
            axios.post('/materials/pipePlan/monthList', params),
        //获取管片明细
        searchDuctDetails: params =>
            axios.post('/m/pipeInfo/findList', params),
    },
    /**
     * 原料实际放量
     */
web/src/components/element/Pagination.vue
@@ -76,7 +76,16 @@
  font-weight: 400;
}
.pagination-container {
::v-deep.pagination-container {
  margin: 30px 0;
  .btn-prev {
    margin-right: 10px;
  }
  .el-pager .number {
    width: 28px;
    margin-right: 10px;
  }
}
</style>
web/src/views/DuctpiecePLM/PlanManage/DuctForward.vue
@@ -0,0 +1,551 @@
<template>
  <div class="main">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">项目名称:</span>
        <el-select v-model="search.proId" placeholder="请选择项目名称" clearable filterable>
          <el-option v-for="item in optionsProject" :key="item.proId" :label="item.proName" :value="item.proId">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">年份:</span>
        <el-date-picker v-model="search.planYear" value-format="yyyy" type="year" placeholder="请选择年份">
        </el-date-picker>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
      </div>
    </div>
    <div class="main_content">
      <div style="overflow-y:auto;overflow-x:hidden;height:calc(100% - 5px)">
        <div class="plan_main_card" v-for="(item, index) in dataList" :key="index">
          <div class="plan_main_header">
            <div class="plan_header_left">
              <span class="plan_header_one">{{ item.proName }}</span>
              <span>{{ item.planYear }}年</span>
            </div>
            <div class="plan_header_right">
              <el-button style="background-image:none;border:1px solid #38B2FA;border-radius:5px;padding:5px 10px;"
                :size="size" v-if="showButton('update')" class="table_btn" @click="updateProp(item)">修改</el-button>
              <el-button
                style="background-image:none;border:1px solid #FD494B;background-color:#434F69;border-radius:5px;padding:5px 10px;"
                :size="size" class="delete_btn" v-if="showButton('delete')" @click="deleteInfo(item)">删除</el-button>
            </div>
          </div>
          <div class="plan_main_content">
            <div class="plan_content_items">
              <div class="plan_content_title">月份</div>
              <div class="plan_content_datas" style="background-color:#052C55;color:#39B5FE"
                v-for="(item, index) in item.monthList" :key="index">{{ item.month }}</div>
              <div class="plan_content_datas" style="background-color:#052C55;color:#39B5FE">合计</div>
            </div>
            <div class="plan_content_items" style="margin-bottom:0px;border-bottom-color:transparent;">
              <div class="plan_content_title">管片计划发运数量(片)</div>
              <div class="plan_content_datas" v-for="(iten, index) in item.monthList" :key="index">
                {{ iten.planProduct }}</div>
              <div class="plan_content_datas">{{ item.needPipeNum }}</div>
            </div>
            <div class="plan_content_items">
              <div class="plan_content_title">已发运管片数量(片)</div>
              <div class="plan_content_datas" v-for="(it, index) in item.monthList" style="cursor:pointer"
                @click="showDetails(item, index + 1)" :key="index">{{ it.completePlanProduct }}</div>
              <div class="plan_content_datas">{{ item.completePipeNum }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <!-- 钢筋笼明细弹框 -->
    <el-dialog class="prop_dialog" title="管片明细" :visible.sync="asyncBeardetails" width="65%">
      <div class="bears_content">
        <el-table v-loading="loadingDetails" :data="bearDetails" height="100%">
          <el-table-column align="center" label="序号" width="60">
            <template #default="scope">
              <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="ringNum" label="环号" align="center"></el-table-column>
          <el-table-column prop="pipeNum" label="管片编号" align="center" width="160"></el-table-column>
          <el-table-column prop="turnName" label="转向" align="center" width="120"></el-table-column>
          <el-table-column prop="reinforcementName" label="配筋" align="center"></el-table-column>
          <el-table-column prop="groutingHolesName" label="注浆孔" align="center"></el-table-column>
          <el-table-column prop="blockNumName" label="块号" align="center"></el-table-column>
          <el-table-column prop="mouldNum" label="模具" align="center"></el-table-column>
          <el-table-column prop="intoModTime" label="入模时间" align="center" width="160"></el-table-column>
          <el-table-column prop="pouringTime" label="浇筑时间" align="center" width="160"></el-table-column>
          <el-table-column prop="checkTime" label="质检时间" align="center" width="160"></el-table-column>
          <el-table-column prop="groupName" label="生产班组" align="center"></el-table-column>
          <el-table-column prop="proName" label="项目" align="center" width="250" show-overflow-tooltip></el-table-column>
          <el-table-column prop="checkResult" label="质量标注" align="center"></el-table-column>
        </el-table>
      </div>
      <div class="bear_footer">
        <el-pagination background @current-change="changeDetailsPageNum" @size-change="changeDetailsPageSize"
          :current-page="pageNumDetails" :page-sizes="[10, 20, 50, 100]" :page-size="pageSizeDetails"
          layout="total, sizes, prev, pager, next, jumper" :total="totalDetails">
        </el-pagination>
      </div>
    </el-dialog>
    <el-dialog class="prop_dialog" :title="asyncTitle === true ? '新增' : asyncTitle === false ? '修改' : '查看'"
      :close-on-click-modal="false" :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="项目名称:" prop="proId">
          <el-select v-model="ruleForm.proId" placeholder="请选择项目名称" :disabled="disabled" clearable>
            <el-option v-for="item in optionsProject" :key="item.proId" :label="item.proName" :value="item.proId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="年份:" prop="planYear">
          <el-date-picker v-model="ruleForm.planYear" value-format="yyyy" :disabled="disabled" type="year"
            placeholder="请选择年份">
          </el-date-picker>
        </el-form-item>
        <div class="months_items">
          <div v-for="(item, index) in monthLists" :key="index" class="month_index">
            <el-input placeholder="请输入" v-model="item.planProduct" type="number" :disabled="disabled">
              <template slot="prepend">{{ item.month }}月</template>
            </el-input>
          </div>
          <div class="months_nums">
            <span>合计:</span>
            <span style="color:#18F8F9;font-size:20px;font-weight:600;margin-left:5px">{{ allMonths }}</span>
            <span>环</span>
          </div>
        </div>
      </el-form>
      <div slot="footer" v-if="asyncTitle !== 'see'">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '../../../pinia/index';
import {throttle, changeSize} from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      disabled: false,//是否禁止修改
      loading: false,
      allMonths: null,//计算出来的总数
      rowId: '',//某一行id
      dataList: [], //管片生产计划信息
      asyncBeardetails: false,
      bearDetails: [],//管片明细
      pageNumDetails: 1,
      pageSizeDetails: 10,
      totalDetails: 0,
      loadingDetails: true,
      proId: null,
      reinforcementId: null,
      years: null,
      optionsProject: [],//项目名称
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {}, // 按钮表单
      rules: {
        proId: [{
          required: true,
          message: '请选择项目名称',
          trigger: 'change'
        }],
        planYear: [{
          required: true,
          message: '请选择年份',
          trigger: 'change'
        }],
      },
      optionsHass: [],//配筋
      optionsBlocks: [],//块号
      monthLists: [],//弹框中的月
      numLists: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, '合计'],
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
    that.searchButtonInfo(true);
    that.getAllProjects()
  },
  watch: {
    'monthLists': {
      handler: function (val) {
        let allNum = 0
        val.map(item => {
          allNum += item.planProduct * 1
        })
        this.allMonths = allNum
        return this.allMonths
      },
      deep: true
    },
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  methods: {
    //展示管片明细弹框
    showDetails(val, num) {
      console.log(val)
      this.asyncBeardetails = true
      if (num === 13) {
        this.asyncBeardetails = false
        return
      }
      this.proId = val.proId
      this.years = num < 10 ? val.planYear + '-0' + num : val.planYear + '-' + num
      this.searchBearDetails(val.proId, this.years)
    },
    //查询管片明细
    searchBearDetails(proId, years) {
      this.loadingDetails = true;
      this.bearDetails = [];
      this.$api.Ducts.ductForward.searchDuctDetails({
        proId: proId,
        goIn: 2,
        yearMonth: years,
        pageNum: this.pageNumDetails,
        pageSize: this.pageSizeDetails
      }).then((res) => {
        if (res.statusMsg === 'ok') {
          this.totalDetails = res.data.total;
          this.bearDetails = res.data.list;
        } else {
          this.$message.warning(res.statusMsg)
        }
        this.loadingDetails = false;
      }).catch(() => {
        this.loadingDetails = false
      });
    },
    // 切换管片明细页数
    changeDetailsPageNum(page) {
      this.pageNumDetails = page;
      this.searchBearDetails(this.proId, this.years);
    },
    // 切换管片明细每页条数
    changeDetailsPageSize(size) {
      this.pageSizeDetails = size;
      this.searchBearDetails(this.proId, this.years);
    },
    //获得所有项目名称
    getAllProjects() {
      let obj = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Engineer.searchProjects(obj).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsProject = res.data.list
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      })
      this.loading = true;
      this.$api.Ducts.ductForward.searchDuctPlan(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
          this.loading = false;
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = false
      this.monthLists = [
        {id: null, pipePlanId: null, month: 1, planProduct: 0},
        {id: null, pipePlanId: null, month: 2, planProduct: 0},
        {id: null, pipePlanId: null, month: 3, planProduct: 0},
        {id: null, pipePlanId: null, month: 4, planProduct: 0},
        {id: null, pipePlanId: null, month: 5, planProduct: 0},
        {id: null, pipePlanId: null, month: 6, planProduct: 0},
        {id: null, pipePlanId: null, month: 7, planProduct: 0},
        {id: null, pipePlanId: null, month: 8, planProduct: 0},
        {id: null, pipePlanId: null, month: 9, planProduct: 0},
        {id: null, pipePlanId: null, month: 10, planProduct: 0},
        {id: null, pipePlanId: null, month: 11, planProduct: 0},
        {id: null, pipePlanId: null, month: 12, planProduct: 0},
      ]
      this.allMonths = 0
    },
    // 修改按钮信息
    updateProp(row) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = false
      this.ruleForm = row
      this.monthLists = JSON.parse(JSON.stringify(row.monthList))
      this.allMonths = row.needPipeNum
      this.$set(this.ruleForm, 'planYear', row.planYear + '')
      this.rowId = row.planId
    },
    // 删除按钮信息
    deleteInfo(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          console.log(row)
          this.$api.Ducts.ductForward.deleteDuctPlan({planOutId: row.planOutId})
            .then(res => {
              if (res.statusMsg === 'ok') {
                this.searchButtonInfo(true);
                this.$message.success("删除成功!");
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
        })
        .catch(() => {
          this.$message.warning("您已取消");
        })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          params.monthList = this.monthLists
          params.needPipeNum = this.allMonths
          this.$api.Ducts.ductForward.insertDuctPlan(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('添加成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交修改按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          params.monthList = this.monthLists
          params.needPipeNum = this.allMonths
          this.$api.Ducts.ductForward.updateDuctPlan(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('添加成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '../../../style/layout-main.scss';
.bears_content {
  height: 500px;
  /deep/ .el-table th.el-table__cell {
    background: #082F57 !important;
    color: #18F6F8;
    border-right: 1px solid #18F6F8 !important;
    border-bottom: 1px solid #18F6F8 !important;
    border-top: 1px solid #18F6F8 !important;
    &:last-child {
      border-right-color: transparent !important;
    }
  }
  /deep/.el-table .el-table__cell {
    border-left: 1px solid #18F6F8 !important;
    border-right: 1px solid #18F6F8 !important;
    border-bottom: 1px solid #18F6F8 !important;
  }
  /deep/.el-table tr:nth-of-type(even) {
    background: transparent;
  }
}
.bear_footer {
  text-align: right;
  line-height: 20px;
  margin: 15px 0 15px;
}
.months_items {
  display: flex;
  flex-wrap: wrap;
  .month_index {
    margin-left: 10px;
    margin-bottom: 10px;
    max-width: calc(100%/3 - 10px);
    /deep/.el-input-group__prepend {
      color: #19F6F8;
      background-color: #122558;
      border-color: #1B428F;
    }
  }
  .months_nums {
    width: 100%;
    height: 50px;
    margin-bottom: 24px;
    border-radius: 3px;
    background-color: #0B5274;
    display: flex;
    align-items: center;
    span {
      margin-left: 15px;
      color: #fff;
    }
  }
}
.plan_main_card {
  width: calc(100% - 36px);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  background-color: #031A46;
  margin: 0px 5px 24px 0px;
  box-shadow: 0px 0px 8px 0px #0C4F79;
  .plan_main_header {
    width: 100%;
    height: 48px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(57, 181, 254, 0.3);
    .plan_header_left {
      display: flex;
      span {
        flex: none;
        color: #39B5FE;
        margin-left: 20px;
        font-size: 16px;
        font-weight: 600;
      }
      .plan_header_one {
        margin-left: 40px;
        position: relative;
        &::before {
          position: absolute;
          left: -14px;
          top: -1px;
          content: '';
          width: 5px;
          height: 20px;
          background-color: #39B5FE;
        }
      }
    }
    .plan_header_right {
      margin-right: 15px;
    }
  }
  .plan_main_content {
    width: 100%;
    height: calc(100% - 30px);
    background-color: #031A46;
    padding-top: 20px;
    padding-bottom: 10px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    .plan_content_items {
      display: flex;
      border: 1px solid #39B5FE;
      margin: 0px 15px 8px 15px;
      .plan_content_title {
        width: 145px;
        padding: 12px 0px;
        flex: none;
        color: #39B5FE;
        text-align: center;
        background-color: #052C55;
      }
      .plan_content_datas {
        flex: 1;
        padding: 12px 0px;
        color: #fff;
        text-align: center;
        border-left: 1px solid #1CB7E0;
      }
    }
  }
}
</style>
web/src/views/MaterialsIndex/components/embedded/Income.vue
@@ -1,369 +1,369 @@
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">预埋件名称:</span>
        <el-input v-model="search.embedmentName" placeholder="请选择预埋件名称" clearable></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">规格型号:</span>
        <el-select v-model="search.embedmentModel" placeholder="请选择规格型号" clearable>
          <el-option v-for="item in optionsNames" :key="item.id" :label="item.embedmentModel"
            :value="item.embedmentModel">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">时间范围:</span>
        <el-date-picker v-model="search.time" type="daterange" :default-time="['00:00:00', '23:59:59']" clearable
          value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" start-placeholder="起始时间" end-placeholder="结束时间">
        </el-date-picker>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
        <el-button icon="el-icon-upload2" v-if="showButton('export')" @click="exportIncomeData">导出Excel</el-button>
        <el-button icon="el-icon-postcard" v-if="showButton('export')" @click="exportIncomeFile">导出模板</el-button>
        <el-upload class="upload-demo" style="margin-left:10px" action="" :multiple="false" :http-request="httpRequest"
          :show-file-list="false" :file-list="fileList">
          <el-button icon="el-icon-download" v-if="showButton('exportIn')" :size="size">导入Excel</el-button>
        </el-upload>
      </div>
    </div>
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="embedmentName" label="预埋件名称" align="center" width="180"></el-table-column>
        <el-table-column prop="embedmentModel" label="规格型号" align="center" width="120"></el-table-column>
        <el-table-column prop="changeStock" label="入库数量" align="center"></el-table-column>
        <el-table-column prop="singlePrice" label="单价" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="amount" label="金额" align="center"></el-table-column>
        <el-table-column prop="createTime" label="入库时间" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="140">
          <template #default="scope">
            <el-button class="table_btn" size="mini" v-if="showButton('update')"
              @click="updateProp(scope.$index)">修改</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('delete')"
              @click="deleteInfo(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog class="prop_dialog" :title="asyncTitle ? '新增入库' : '修改入库信息'" :close-on-click-modal="false"
      :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="预埋件名称:" prop="embedmentId">
          <el-select v-model="ruleForm.embedmentId" :size="size" placeholder="请选择预埋件名称" @change="changeName">
            <el-option v-for="item in optionsNames" :key="item.id"
              :label="`${item.embedmentName} - ${item.embedmentModel}`" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" placeholder="请选择规格型号" disabled></el-input>
        </el-form-item>
        <el-form-item label="入库数量:" prop="changeStock">
          <el-input v-model="ruleForm.changeStock" :size="size" type="number" clearable placeholder="请输入入库数量"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="单价:" prop="singlePrice">
          <el-input v-model="ruleForm.singlePrice" type="number" :size="size" clearable placeholder="请输入单价"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="金额:" prop="amount">
          <el-input v-model="ruleForm.amount" :size="size" clearable placeholder="请输入金额" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input v-model="ruleForm.remark" :size="size" type="textarea" :rows="2" clearable
            placeholder="请输入备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '@/pinia/index';
import {throttle, changeSize, downFiles} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      loading: false,
      disabled: false,//是否禁止修改
      dataList: [], //入库记录信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {
        embedmentModel: '',
      }, // 按钮表单
      rules: {
        embedmentId: [{
          required: true,
          message: '请选择物品型号',
          trigger: 'change'
        }],
        embedmentModel: [{
          required: true,
          message: '请选择供应商',
          trigger: 'blur'
        }],
        changeStock: [{
          required: true,
          message: '请输入入库数量',
          trigger: 'blur'
        }],
        singlePrice: [{
          required: true,
          message: '请输入单价',
          trigger: 'blur'
        }],
        amount: [{
          required: true,
          message: '请输入金额',
          trigger: 'blur'
        }],
      },
      optionsNames: [],//物品名称
      fileList: [],//导入
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
  },
  methods: {
    //导出数据
    exportIncomeData() {
      this.functionLoading();
      let params = Object.assign({}, this.search, {
        stockType: 1
      })
      this.$api.Materials.embedded.incomeExportxls(params).then(res => {
        downFiles(res, '入库记录信息', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    //计算金额
    priceChange() {
      if (this.ruleForm.singlePrice !== undefined && this.ruleForm.changeStock !== undefined) {
        this.$set(this.ruleForm, 'amount', this.ruleForm.singlePrice * 1 * this.ruleForm.changeStock)
      } else {
        this.$set(this.ruleForm, 'amount', ' ')
      }
    },
    //获取所有预埋件名称
    getNameList() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeGetLists(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsNames = res.data.list
        }
      })
    },
    //自定义上传
    httpRequest({file}) {
      this.functionLoading();
      const formData = new FormData();
      formData.set('file', file);
      this.$api.Materials.embedded.incomeInXls(formData).then((res) => {
        if (res.success) {
          this.searchButtonInfo();
          this.$message.success('上传成功!');
          this.loadingView.close();
        } else {
          this.$message.warning(typeof (res.data) === 'object' ? res.statusMsg : res.data);
          this.loadingView.close();
        }
      })
        .catch(() => {
          this.$message.error('请检查网络设置!');
          this.loadingView.close();
        })
    },
    // 转圈圈
    functionLoading() {
      this.loadingView = this.$loading({
        lock: true,
        text: '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    //导出模板
    exportIncomeFile() {
      this.functionLoading();
      this.$api.Materials.embedded.incomeExportXls({}).then(res => {
        downFiles(res, '入库记录信息模板', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        stockType: 1
      })
      params.strTime = this.search.time && this.search.time[0]
      params.endTime = this.search.time && this.search.time[1]
      delete params.time
      this.loading = true;
      this.$api.Materials.embedded.incomeGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        } else {
          this.$message.warning(res.statusMsg)
        }
        this.loading = false;
      })
    },
    // 根据预埋件名称选择规格型号
    changeName(val) {
      const array = this.optionsNames
      for (let index = 0; index < array.length; index++) {
        const item = array[index]
        if (item.id === val) {
          this.ruleForm.embedmentModel = item.embedmentModel
          break
        }
      }
    },
    // 修改按钮信息
    updateProp(index) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = this.dataList[index]
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = true
    },
    // 删除按钮信息
    deleteInfo(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$api.Materials.embedded.incomeDel({id: row.id})
          .then(res => {
            if (res.statusMsg === 'ok') {
              this.searchButtonInfo(true);
              this.$message.success("删除成功!");
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
      }).catch(() => {
        this.$message.warning("您已取消");
      })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          params.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeInsert(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('添加成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交修改按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          params.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeUpdate(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('修改成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">预埋件名称:</span>
        <el-input v-model="search.embedmentName" placeholder="请输入预埋件名称" clearable></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">规格型号:</span>
        <el-select v-model="search.embedmentModel" placeholder="请选择规格型号" clearable>
          <el-option v-for="item in optionsNames" :key="item.id" :label="item.embedmentModel"
            :value="item.embedmentModel">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">时间范围:</span>
        <el-date-picker v-model="search.time" type="daterange" :default-time="['00:00:00', '23:59:59']" clearable
          value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" start-placeholder="起始时间" end-placeholder="结束时间">
        </el-date-picker>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
        <el-button icon="el-icon-upload2" v-if="showButton('export')" @click="exportIncomeData">导出Excel</el-button>
        <el-button icon="el-icon-postcard" v-if="showButton('export')" @click="exportIncomeFile">导出模板</el-button>
        <el-upload class="upload-demo" style="margin-left:10px" action="" :multiple="false" :http-request="httpRequest"
          :show-file-list="false" :file-list="fileList">
          <el-button icon="el-icon-download" v-if="showButton('exportIn')" :size="size">导入Excel</el-button>
        </el-upload>
      </div>
    </div>
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="embedmentName" label="预埋件名称" align="center" width="180"></el-table-column>
        <el-table-column prop="embedmentModel" label="规格型号" align="center" width="120"></el-table-column>
        <el-table-column prop="changeStock" label="入库数量" align="center"></el-table-column>
        <el-table-column prop="singlePrice" label="单价" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="amount" label="金额" align="center"></el-table-column>
        <el-table-column prop="createTime" label="入库时间" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="140">
          <template #default="scope">
            <el-button class="table_btn" size="mini" v-if="showButton('update')"
              @click="updateProp(scope.$index)">修改</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('delete')"
              @click="deleteInfo(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog class="prop_dialog" :title="asyncTitle ? '新增入库' : '修改入库信息'" :close-on-click-modal="false"
      :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="预埋件名称:" prop="embedmentId">
          <el-select v-model="ruleForm.embedmentId" :size="size" placeholder="请选择预埋件名称" @change="changeName">
            <el-option v-for="item in optionsNames" :key="item.id"
              :label="`${item.embedmentName} - ${item.embedmentModel}`" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" placeholder="请选择规格型号" disabled></el-input>
        </el-form-item>
        <el-form-item label="入库数量:" prop="changeStock">
          <el-input v-model="ruleForm.changeStock" :size="size" type="number" clearable placeholder="请输入入库数量"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="单价:" prop="singlePrice">
          <el-input v-model="ruleForm.singlePrice" type="number" :size="size" clearable placeholder="请输入单价"
            @blur="priceChange"></el-input>
        </el-form-item>
        <el-form-item label="金额:" prop="amount">
          <el-input v-model="ruleForm.amount" :size="size" clearable placeholder="请输入金额" :disabled="disabled"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input v-model="ruleForm.remark" :size="size" type="textarea" :rows="2" clearable
            placeholder="请输入备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '@/pinia/index';
import {throttle, changeSize, downFiles} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      loading: false,
      disabled: false,//是否禁止修改
      dataList: [], //入库记录信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {
        embedmentModel: '',
      }, // 按钮表单
      rules: {
        embedmentId: [{
          required: true,
          message: '请选择物品型号',
          trigger: 'change'
        }],
        embedmentModel: [{
          required: true,
          message: '请选择供应商',
          trigger: 'blur'
        }],
        changeStock: [{
          required: true,
          message: '请输入入库数量',
          trigger: 'blur'
        }],
        singlePrice: [{
          required: true,
          message: '请输入单价',
          trigger: 'blur'
        }],
        amount: [{
          required: true,
          message: '请输入金额',
          trigger: 'blur'
        }],
      },
      optionsNames: [],//物品名称
      fileList: [],//导入
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
  },
  methods: {
    //导出数据
    exportIncomeData() {
      this.functionLoading();
      let params = Object.assign({}, this.search, {
        stockType: 1
      })
      this.$api.Materials.embedded.incomeExportxls(params).then(res => {
        downFiles(res, '入库记录信息', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    //计算金额
    priceChange() {
      if (this.ruleForm.singlePrice !== undefined && this.ruleForm.changeStock !== undefined) {
        this.$set(this.ruleForm, 'amount', this.ruleForm.singlePrice * 1 * this.ruleForm.changeStock)
      } else {
        this.$set(this.ruleForm, 'amount', ' ')
      }
    },
    //获取所有预埋件名称
    getNameList() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeGetLists(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsNames = res.data.list
        }
      })
    },
    //自定义上传
    httpRequest({file}) {
      this.functionLoading();
      const formData = new FormData();
      formData.set('file', file);
      this.$api.Materials.embedded.incomeInXls(formData).then((res) => {
        if (res.success) {
          this.searchButtonInfo();
          this.$message.success('上传成功!');
          this.loadingView.close();
        } else {
          this.$message.warning(typeof (res.data) === 'object' ? res.statusMsg : res.data);
          this.loadingView.close();
        }
      })
        .catch(() => {
          this.$message.error('请检查网络设置!');
          this.loadingView.close();
        })
    },
    // 转圈圈
    functionLoading() {
      this.loadingView = this.$loading({
        lock: true,
        text: '请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    //导出模板
    exportIncomeFile() {
      this.functionLoading();
      this.$api.Materials.embedded.incomeExportXls({}).then(res => {
        downFiles(res, '入库记录信息模板', 'xls')
        this.loadingView.close()
      })
        .catch(() => {
          this.loadingView.close();
        })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        stockType: 1
      })
      params.strTime = this.search.time && this.search.time[0]
      params.endTime = this.search.time && this.search.time[1]
      delete params.time
      this.loading = true;
      this.$api.Materials.embedded.incomeGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        } else {
          this.$message.warning(res.statusMsg)
        }
        this.loading = false;
      })
    },
    // 根据预埋件名称选择规格型号
    changeName(val) {
      const array = this.optionsNames
      for (let index = 0; index < array.length; index++) {
        const item = array[index]
        if (item.id === val) {
          this.ruleForm.embedmentModel = item.embedmentModel
          break
        }
      }
    },
    // 修改按钮信息
    updateProp(index) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.disabled = true
      this.ruleForm = this.dataList[index]
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
      this.disabled = true
    },
    // 删除按钮信息
    deleteInfo(row) {
      this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$api.Materials.embedded.incomeDel({id: row.id})
          .then(res => {
            if (res.statusMsg === 'ok') {
              this.searchButtonInfo(true);
              this.$message.success("删除成功!");
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
      }).catch(() => {
        this.$message.warning("您已取消");
      })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          params.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeInsert(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('添加成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交修改按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          params.changeStock = this.ruleForm.changeStock * 1
          params.singlePrice = this.ruleForm.singlePrice * 1
          params.stockType = 1
          this.$api.Materials.embedded.incomeUpdate(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('修改成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
</style>
web/src/views/MaterialsIndex/components/embedded/Type.vue
@@ -1,244 +1,244 @@
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">预埋件名称:</span>
        <el-input v-model="search.embedmentName" :size="size" clearable placeholder="请输入物品名称"></el-input>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="embedmentName" label="预埋件名称" align="center"></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center"></el-table-column>
        <el-table-column prop="embedmentModel" label="型号规格" align="center"></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="position" label="位置" align="center"></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">修改</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog class="prop_dialog" :title="asyncTitle ? '新增辅材种类' : '修改辅材种类'" :close-on-click-modal="false"
      :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="预埋件名称:" prop="embedmentName">
          <el-input v-model="ruleForm.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"
            @input="changeInput"></el-input>
        </el-form-item>
        <el-form-item label="类别:" prop="embedmentType">
          <el-select v-model="ruleForm.embedmentType" placeholder="请选择类别">
            <el-option v-for="item in optionsType" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" :size="size" clearable placeholder="请输入规格型号"></el-input>
        </el-form-item>
        <el-form-item label="计量单位:" prop="unit">
          <el-input v-model="ruleForm.unit" :size="size" clearable placeholder="请输入计量单位"></el-input>
        </el-form-item>
        <el-form-item label="位置:" prop="position">
          <el-input v-model="ruleForm.position" :size="size" clearable placeholder="请输入位置"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input v-model="ruleForm.remark" :size="size" clearable placeholder="请输入备注" type="textarea"
            :rows="2"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '@/pinia/index';
import {throttle, changeSize} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      loading: false,
      optionsType: [],//辅材类别
      dataList: [], //辅材种类信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {}, // 按钮表单
      rules: {
        embedmentName: [{
          required: true,
          message: '请输入物品名称',
          trigger: 'blur'
        }],
        embedmentModel: [{
          required: true,
          message: '请输入规格型号',
          trigger: 'blur'
        }],
        unit: [{
          required: true,
          message: '请输入单位',
          trigger: 'blur'
        }],
        position: [{
          required: true,
          message: '请输入位置',
          trigger: 'blur'
        }],
      },
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
    that.searchButtonInfo(true);
  },
  methods: {
    //输入增加限制
    changeInput(val) {
      let reg = RegExp(/-/)
      if (reg.test(val)) {
        this.$message.warning('禁止输入‘-’字符!!!')
        this.$set(this.ruleForm, 'embedmentName', '')
      }
    },
    //获取辅材类别信息
    getAllTypes() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeModels(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsType = res.data
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      })
      this.loading = true;
      this.$api.Materials.embedded.typeGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        }
        this.loading = false;
      })
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
    },
    // 修改按钮信息
    updateProp(row) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.$api.Materials.embedded.typeDetail({id: row.id}).then(res => {
        if (res.statusMsg === 'ok') {
          this.ruleForm = res.data
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          this.$api.Materials.embedded.typeInsert(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('添加成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交修改按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          this.$api.Materials.embedded.typeUpdate(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('修改成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">预埋件名称:</span>
        <el-input v-model="search.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"></el-input>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table v-loading="loading" :data="dataList" height="100%">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="embedmentName" label="预埋件名称" align="center"></el-table-column>
        <el-table-column prop="dictName" label="类别" align="center"></el-table-column>
        <el-table-column prop="embedmentModel" label="型号规格" align="center"></el-table-column>
        <el-table-column prop="unit" label="计量单位" align="center"></el-table-column>
        <el-table-column prop="position" label="位置" align="center"></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">修改</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination background @current-change="changePageNum" @size-change="changePageSize" :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog class="prop_dialog" :title="asyncTitle ? '新增预埋件种类' : '修改预埋件种类'" :close-on-click-modal="false"
      :visible.sync="asyncVisible" width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
        <el-form-item label="预埋件名称:" prop="embedmentName">
          <el-input v-model="ruleForm.embedmentName" :size="size" clearable placeholder="请输入预埋件名称"
            @input="changeInput"></el-input>
        </el-form-item>
        <el-form-item label="类别:" prop="embedmentType">
          <el-select v-model="ruleForm.embedmentType" placeholder="请选择类别">
            <el-option v-for="item in optionsType" :key="item.dictId" :label="item.dictName" :value="item.dictId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号:" prop="embedmentModel">
          <el-input v-model="ruleForm.embedmentModel" :size="size" clearable placeholder="请输入规格型号"></el-input>
        </el-form-item>
        <el-form-item label="计量单位:" prop="unit">
          <el-input v-model="ruleForm.unit" :size="size" clearable placeholder="请输入计量单位"></el-input>
        </el-form-item>
        <el-form-item label="位置:" prop="position">
          <el-input v-model="ruleForm.position" :size="size" clearable placeholder="请输入位置"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input v-model="ruleForm.remark" :size="size" clearable placeholder="请输入备注" type="textarea"
            :rows="2"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {buttonPinia} from '@/pinia/index';
import {throttle, changeSize} from '@/plugins/public'; // 导入节流、动态切换组件尺寸方法
export default {
  data() {
    return {
      size: changeSize(), // 组件尺寸
      pageNum: 1,
      pageSize: 10,
      search: {},//查询条件
      total: 0,
      loading: false,
      optionsType: [],//辅材类别
      dataList: [], //辅材种类信息列表
      asyncTitle: true, // 对话框title 新增:true  修改:false
      asyncVisible: false, // 添加 修改对话框
      ruleForm: {}, // 按钮表单
      rules: {
        embedmentName: [{
          required: true,
          message: '请输入物品名称',
          trigger: 'blur'
        }],
        embedmentModel: [{
          required: true,
          message: '请输入规格型号',
          trigger: 'blur'
        }],
        unit: [{
          required: true,
          message: '请输入单位',
          trigger: 'blur'
        }],
        position: [{
          required: true,
          message: '请输入位置',
          trigger: 'blur'
        }],
      },
    }
  },
  watch: {
    asyncVisible(bol) {
      if (!bol) {
        this.ruleForm = {};
        this.$refs.ruleForm.resetFields();
      }
    }
  },
  mounted() {
    const that = this;
    // 根据窗口大小动态修改组件尺寸
    window.onresize = () => {
      that.size = changeSize();
    }
    that.searchButtonInfo(true);
  },
  methods: {
    //输入增加限制
    changeInput(val) {
      let reg = RegExp(/-/)
      if (reg.test(val)) {
        this.$message.warning('禁止输入‘-’字符!!!')
        this.$set(this.ruleForm, 'embedmentName', '')
      }
    },
    //获取辅材类别信息
    getAllTypes() {
      let params = {
        pageNum: 1,
        pageSize: 100000000
      }
      this.$api.Materials.embedded.typeModels(params).then(res => {
        if (res.statusMsg === 'ok') {
          this.optionsType = res.data
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 查询按钮列表信息
    searchButtonInfo(bol) {
      if (bol) {
        this.pageNum = 1;
      }
      let params = Object.assign({}, this.search, {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      })
      this.loading = true;
      this.$api.Materials.embedded.typeGetLists(params).then((res) => {
        if (res.statusMsg === 'ok') {
          this.total = res.data.total;
          this.dataList = res.data.list;
        }
        this.loading = false;
      })
    },
    // 新增按钮信息
    insertProp() {
      this.asyncTitle = true;
      this.asyncVisible = true;
    },
    // 修改按钮信息
    updateProp(row) {
      this.asyncTitle = false;
      this.asyncVisible = true;
      this.$api.Materials.embedded.typeDetail({id: row.id}).then(res => {
        if (res.statusMsg === 'ok') {
          this.ruleForm = res.data
        } else {
          this.$message.warning(res.statusMsg)
        }
      })
    },
    // 提交添加按钮信息
    submitInsert: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          this.$api.Materials.embedded.typeInsert(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('添加成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 提交修改按钮信息
    submitUpdate: throttle(function () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.ruleForm);
          this.$api.Materials.embedded.typeUpdate(params).then((res) => {
            if (res.statusMsg === 'ok') {
              this.asyncVisible = false;
              this.searchButtonInfo(true);
              this.$message.success('修改成功!');
            } else {
              this.$message.warning(res.statusMsg);
            }
          })
        }
      })
    }, 3000),
    // 判断按钮权限信息
    showButton(str) {
      const pinia = buttonPinia();
      return pinia.$state.buttonInfo.includes(str);
    },
    // 切换页数
    changePageNum(page) {
      this.pageNum = page;
      this.searchButtonInfo();
    },
    // 切换每页条数
    changePageSize(size) {
      this.pageSize = size;
      this.searchButtonInfo();
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
</style>
web/src/views/ProjectManage/SectionManage.vue
@@ -48,7 +48,7 @@
          <el-input v-model="ruleForm.unitProjectName" clearable placeholder="请输入单位工程名称"></el-input>
        </el-form-item>
        <el-form-item label="需求负责人:" prop="segmentAdmin">
          <el-select v-model="ruleForm.segmentAdmin" placeholder="请选择求负责人">
          <el-select v-model="ruleForm.segmentAdmin" placeholder="请选择需求负责人">
            <el-option v-for="item in optionsUser" :key="item.userId" :label="item.realName" :value="item.userId">
            </el-option>
          </el-select>