licp
2024-12-20 13900c0be3a45f7e53fef8f7f53c1e67dc3c6c52
完成不符合项分布迁移
已修改1个文件
已添加2个文件
491 ■■■■■ 文件已修改
src/assets/api/controller.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/a7-distribution-of-nonconforming/formDia.vue 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/a7-distribution-of-nonconforming.vue 245 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -63,6 +63,7 @@
    measuresAddressRisksOpportunities,
    processReport,
    processComplain,
    inconsistentDistribution,
  }
}
@@ -827,4 +828,14 @@
  getProcessComplain:'/processComplain/getProcessComplain',//投诉处理详情
  doProcessComplain:'/processComplain/doProcessComplain',//投诉处理修改
  exportProcessComplain :'/processComplain/exportProcessComplain ',//投诉处理导出
}
}
// 7.10不符合项分布
const inconsistentDistribution = {
  pageInconsistentDistribution:'/inconsistentDistribution/pageInconsistentDistribution', // ä¸ç¬¦åˆé¡¹çš„分布分页查询
  getInconsistentDistributionOne:'/inconsistentDistribution/getInconsistentDistributionOne', // ä¸ç¬¦åˆé¡¹çš„分布详情
  addInconsistentDistribution:'/inconsistentDistribution/addInconsistentDistribution', // ä¸ç¬¦åˆé¡¹çš„分布新增
  updateInconsistentDistribution:'/inconsistentDistribution/updateInconsistentDistribution', // ä¸ç¬¦åˆé¡¹çš„分布修改
  delInconsistentDistribution:'/inconsistentDistribution/delInconsistentDistribution', // ä¸ç¬¦åˆé¡¹çš„分布删除
  exportInconsistentDistribution:'/inconsistentDistribution/exportInconsistentDistribution', // å¯¼å‡ºä¸ç¬¦åˆé¡¹çš„分布
}
src/components/do/a7-distribution-of-nonconforming/formDia.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,233 @@
<template>
  <div>
    <el-dialog v-loading="diaLoading" :close-on-click-modal="false"
               :close-on-press-escape="false"
               :visible.sync="formDia"
               title="不符合项的分布"
               width="90%" @close="closeDia">
      <table border="1" cellspacing="10" class="table">
        <tr>
          <td>章节号</td>
          <th class="div-with-line">
            <span style="float: left;">要素</span>
            <span style="float: right;">部门</span>
          </th>
          <th>主任</th>
          <th>技术负责人</th>
          <th>质量负责人</th>
          <th>综合室</th>
          <th>试验室</th>
          <th>合计</th>
          <th>占%</th>
        </tr>
        <tr v-for="(item, index) in distributionDetailList" :key="item.value">
          <td>{{item.chapterNumber}}</td>
          <th>{{item.essentials}}</th>
          <th>
            <el-input-number v-model="item.director" :precision="0" clearable size="small"></el-input-number>
          </th>
          <th>
            <el-input-number v-model="item.technology" :precision="0" clearable size="small"></el-input-number>
          </th>
          <th>
            <el-input-number v-model="item.quality" :precision="0" clearable size="small"></el-input-number>
          </th>
          <th>
            <el-input-number v-model="item.comprehensive" :precision="0" clearable size="small"></el-input-number>
          </th>
          <th>
            <el-input-number v-model="item.testing" :precision="0" clearable size="small"></el-input-number>
          </th>
          <th>
              {{item.total}}
          </th>
          <th>
            {{(item.proportion?item.proportion:0) + '%'}}
          </th>
        </tr>
          <tr>
              <td> </td>
              <th>
                  å æ¯”
              </th>
              <th>
                  {{(distributionProportion.director?distributionProportion.director:0) + '%'}}
              </th>
              <th>
                  {{(distributionProportion.technology?distributionProportion.technology:0) + '%'}}
              </th>
              <th>
                  {{(distributionProportion.quality?distributionProportion.quality:0) + '%'}}
              </th>
              <th>
                  {{(distributionProportion.comprehensive?distributionProportion.comprehensive:0) + '%'}}
              </th>
              <th>
                  {{(distributionProportion.testing?distributionProportion.testing:0) + '%'}}
              </th>
              <th>
                  {{distributionProportion.total?distributionProportion.total:0}}
              </th>
              <th> </th>
          </tr>
      </table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDia">取 æ¶ˆ</el-button>
        <el-button :loading="loading" type="primary" @click="handleEdit">提 äº¤</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'formDia',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      formDia: false,
      diaLoading: false,
      loading: false,
      distributionDetailList: [],
      form: {
      },
        distributionProportion: {}
    };
  },
  mounted() {
  },
  // æ–¹æ³•集合
  methods: {
    // æ‰“开弹框
    openDia (type, row) {
      this.formDia = true
      this.operationType = type
      if (type !== 'add') {
        this.searchInfo(row)
      } else {
        this.selectEnumByCategory()
      }
    },
    // æŸ¥è¯¢è¯¦æƒ…
    searchInfo (row) {
      this.diaLoading = true
      this.$axios(this.$api.inconsistentDistribution.getInconsistentDistributionOne + '?distributionId=' + row.distributionId).then(res => {
        this.diaLoading = false
        if (res.code === 201) return
        this.form = res.data
        this.distributionDetailList = this.form.distributionDetailList
        this.distributionProportion = this.form.distributionProportion
      }).catch(err => {
        console.log(err)
        this.diaLoading = false
      })
    },
    // æäº¤å¼¹æ¡†æ•°æ®
    handleEdit () {
      const date = new Date();
      const year = date.getFullYear();
      this.loading = true
      const internalPlan = this.HaveJson(this.form)
      internalPlan.distributionYear = year
      internalPlan.distributionDetailList = this.HaveJson(this.distributionDetailList)
      if (this.operationType === 'add') {
        this.$axios.post(this.$api.inconsistentDistribution.addInconsistentDistribution, internalPlan, {
          headers: {
            "Content-Type": "application/json"
          },
          noQs: true
        }).then(res => {
          this.loading = false
          if (res.code === 201) return
          this.$message.success('操作成功')
          this.closeDia()
        }).catch(err => {
          console.log('err---', err);
          this.loading = false
        })
      } else if (this.operationType === 'edit') {
        this.$axios.post(this.$api.inconsistentDistribution.updateInconsistentDistribution, internalPlan, {
          headers: {
            "Content-Type": "application/json"
          },
          noQs: true
        }).then(res => {
          this.loading = false
          if (res.code === 201) return
          this.$message.success('操作成功')
          this.closeDia()
        }).catch(err => {
          console.log('err---', err);
          this.loading = false
        })
      }
    },
    closeDia () {
      this.formDia = false
      this.$emit('closeDia')
    },
    selectEnumByCategory() {
      this.distributionDetailList = []
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "要素"
      }).then(res => {
        res.data.map((item) => {
          const obj = Object.assign({
            essentials: item.label,
            chapterNumber: item.value,
          })
          this.distributionDetailList.push(obj)
        })
      })
    },
  }
};
</script>
<style scoped>
>>>.el-dialog {
  margin: 6vh auto 50px !important;
}
>>> .el-dialog__body {
  max-height: 68vh;
  overflow-y: auto;
}
>>> .is-required {
  margin-bottom: 6px;
}
.table {
  width: 100%;
  margin-top: 20px;
}
.table td {
  width: 30px;
  text-align: center;
}
.table th {
  width: 70px;
  height: 70px;
  text-align: center;
}
.div-with-line {
  width: 70px;
  height: 70px;
  position: relative;
  /*overflow: hidden; /* éšè—æº¢å‡ºå†…容 */
}
.div-with-line::after {
  content: '';
  position: absolute;
  bottom: 0;
  height: 1px;
  background-color: #000000;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  transform-origin: center 50%;
  top: 50%;
  width: 100px;
}
</style>
src/components/view/a7-distribution-of-nonconforming.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,245 @@
<template>
  <div>
    <div>
      <div class="view-title">
        <span>不符合项的分布</span>
        <span>
          <el-button size="medium" type="primary" @click="openFormDia('add')">新 å¢ž</el-button>
        </span>
      </div>
      <div class="search-background">
        <span class="search-group">
          <span style="width: 120px">年份:</span>
          <el-input v-model="searchForm.distributionYear" clearable size="small"></el-input>
        </span>
        <span class="search-group">
          <el-button size="medium"  @click="resetSearchForm">重 ç½®</el-button>
          <el-button size="medium" type="primary" @click="searchList">查 è¯¢</el-button>
        </span>
      </div>
      <div class="table">
        <div>
          <TableCard :showForm="false" :showTitle="false">
            <template v-slot:table>
              <ZTTable
                :column="tableColumn"
                :height="'calc(100vh - 23em)'"
                :table-data="tableData"
                :table-loading="tableLoading"
                style="padding: 0 15px;margin-bottom: 16px">
              </ZTTable>
            </template>
          </TableCard>
          <el-pagination :current-page="1" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]"
                         :total="total" layout="->,total, sizes, prev, pager, next, jumper"
                         @size-change="handleSizeChange"
                         @current-change="handleCurrentChange">
          </el-pagination>
        </div>
      </div>
    </div>
    <form-dia v-if="formDia" ref="formDia" @closeDia="closeDia"></form-dia>
  </div>
</template>
<script>
import ZTTable from '../caorui/ZTTable/index.vue';
import TableCard from '../caorui/TableCard/index.vue';
import FormDia from '../do/a7-distribution-of-nonconforming/formDia.vue';
export default {
  name: 'a7-distribution-of-nonconforming',
  // import å¼•入的组件需要注入到对象中才能使用
  components: { FormDia, TableCard, ZTTable },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      searchForm: {
        distributionYear: '',
      },
      tableColumn: [
        {
          label: '年份',
          prop: 'distributionYear',
          minWidth: '100'
        },
        {
          label: '创建人',
          prop: 'createUserName',
          minWidth: '100'
        },
        {
          label: '创建时间',
          prop: 'createTime',
          minWidth: '100'
        },
        {
          label: '修改人',
          prop: 'updateUserName',
          minWidth: '100'
        },
        {
          label: '修改时间',
          prop: 'updateTime',
          minWidth: '100'
        },
        {
          dataType: 'action',
          minWidth: '220',
          label: '操作',
          operation: [
            {
              name: '导出',
              type: 'text',
              clickFun: (row) => {
                this.handleDown(row)
              }
            },
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openFormDia('edit', row);
              },
            },
            {
              name: '删除',
              type: 'text',
              color: '#f56c6c',
              clickFun: (row) => {
                this.delPlan(row)
              },
            }
          ]
        }
      ],
      tableData: [],
      tableLoading: false,
      page: {
        size: 20,
        current: 1,
      },
      total: 0,
      formDia: false,
    };
  },
  mounted() {
    this.searchList()
  },
  // æ–¹æ³•集合
  methods: {
    // æŸ¥è¯¢åˆ—表
    searchList () {
      const entity = this.searchForm
      const page = this.page
      this.tableLoading = true
      this.$axios.post(this.$api.inconsistentDistribution.pageInconsistentDistribution, {entity, page}, {
        headers: {
          "Content-Type": "application/json"
        },
        noQs: true
      }).then(res => {
        this.tableLoading = false
        if (res.code === 201) return
        this.tableData = res.data.records
        this.total = res.data.total
      }).catch(err => {
        console.log('err---', err);
        this.tableLoading = false
      })
    },
    // åˆ é™¤
    delPlan (row) {
      this.$confirm('此操作将永久删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableLoading = true
        this.$axios.get(this.$api.inconsistentDistribution.delInconsistentDistribution + '?distributionId=' + row.distributionId).then(res => {
          this.tableLoading = false
          if (res.code === 201) return
          this.$message.success('删除成功')
          this.searchList()
        }).catch(err => {
          this.tableLoading = false
          console.log('err---', err);
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // æ–°å¢žï¼Œç¼–辑,批准弹框
    openFormDia (type, row) {
      this.formDia = true
      this.$nextTick(() => {
        this.$refs.formDia.openDia(type, row)
      })
    },
    // å¯¼å‡º
    handleDown (row) {
      this.$axios.get(this.$api.inconsistentDistribution.exportInconsistentDistribution + '?distributionId=' + row.distributionId,{responseType: "blob"}).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        const blob = new Blob([res],{ type: 'application/msword' });
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = '不符合项的分布' + '.docx';
        link.click();
      })
    },
    closeDia () {
      this.formDia = false
      this.searchList()
    },
    // é‡ç½®æŸ¥è¯¢æ¡ä»¶
    resetSearchForm () {
      this.searchForm.distributionYear = '';
      this.searchList()
    },
    // åˆ†é¡µ
    handleSizeChange(val) {
      this.page.size = val;
      this.searchList();
    },
    handleCurrentChange(val) {
      this.page.current = val;
      this.searchList();
    },
  }
};
</script>
<style scoped>
.view-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  padding-left: 20px;
}
.search-background {
  width: 100%;
  height: 80px;
  line-height: 80px;
  background-color: #ffffff;
  display: flex;
}
.search-group {
  display: flex;
  align-items: center;
  margin: 0 20px;
}
.table {
  margin-top: 20px;
  background-color: #ffffff;
  padding-top: 20px;
}
</style>