田源
2024-03-01 4d6ef8b333cb6b9a4ca97966c6a696d56b0f3c89
Source/UBCS-WEB/src/views/wel/Statistic.vue
@@ -8,10 +8,10 @@
    <el-dialog :visible.sync="dialogTableVisible" append-to-body class="avue-dialog avue-dialog--top" title="主数据配置"
               top='-40px'>
      <el-table
        ref="TableBox"
        :data="Crud.data"
        border
        style="width: 100%"
        ref="TableBox"
        @selection-change="selectionChange"
        @row-click="TableRoute">
        <el-table-column
@@ -53,7 +53,7 @@
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button plain type="primary" @click="SaveHandler">保存</el-button>
        <el-button plain type="primary" @click="SaveHandler" v-loading="BtnLoading">保存</el-button>
      </div>
    </el-dialog>
  </div>
@@ -66,6 +66,7 @@
  name: "Statistic",
  data() {
    return {
      BtnLoading: false,
      loading: true,
      Crud: {
        form: '',
@@ -97,7 +98,7 @@
    FontInfo() {
      this.$nextTick(() => {
        const dataFatherBox = this.$refs.dataBox.$el;
        console.log(dataFatherBox);
        // console.log(dataFatherBox);
        this.$nextTick(() => {
          setTimeout(() => {
            //字体
@@ -109,7 +110,7 @@
              info.style.fontSize = '16px';
            });
            items.forEach((item) => {
              item.style.border = '1px solid  rgb(200, 200, 200, 1)';
              item.style.border = '1px solid  #DCDFE6';
            });
            this.loading = false;
          }, 1000); // 延迟1秒查找info元素
@@ -120,43 +121,41 @@
      // console.log(row)
      this.SelectRow = row;
    },
    SaveHandler() {
    async SaveHandler() {
      if (this.SelectRow.length <= 0) {
        this.$message.warning('请选择一条数据!')
        return
        this.$message.warning('请选择一条数据!');
        return;
      }
      let mdmNameList = [];
      mdmNameList = this.SelectRow.map(item => {
        return item.code
      })
      console.log(mdmNameList)
      save(this.userId, mdmNameList).then(res => {
        console.log(res)
        if (res.data.code === 200) {
          this.$message.success('保存成功!')
          //清除已有数组中push数据
      this.BtnLoading = true;
      try {
        const {data: {code}} = await save(this.userId, this.SelectRow.map(item => item.code));
        if (code === 200) {
          this.$message.success('保存成功!');
          this.newData = [];
          this.option.data=[]
          this.MasterGetList()
          this.option.data = [];
          this.MasterGetList();
          this.dialogTableVisible = false;
          //字体和边框重新加载
          this.BtnLoading = false;
          this.loading = true;
          this.FontInfo()
          this.FontInfo();
        }
      })
      } catch {
        this.BtnLoading = false;
      }
    },
    MoreHandler() {
      this.dialogTableVisible = true;
      let checkedrow=[]
      this.newData.forEach(item=>{
        this.option.data.forEach(v=>{
          if(item.code === v.code){
      let checkedrow = []
      this.newData.forEach(item => {
        this.option.data.forEach(v => {
          if (item.code === v.code) {
            checkedrow.push(item)
          }
        })
      })
      console.log(checkedrow)
      this.$nextTick(()=>{
      // console.log(checkedrow)
      this.$nextTick(() => {
        checkedrow.forEach(row => {
          this.$refs.TableBox.toggleRowSelection(row, true) // 回显
        })
@@ -179,7 +178,7 @@
          this.Crud.data = this.newData;
          if (item.isDefault === 1) {
            const colors = ['rgb(49, 180, 141)', 'rgb(56, 161, 242)', 'rgb(117, 56, 199)', 'rgb(242, 104, 31)',
              'rgb(19, 150, 111)','rgb(26, 131, 212)', 'rgb(87, 26, 169)', 'rgb(212, 83, 1)'];
              'rgb(19, 150, 111)', 'rgb(26, 131, 212)', 'rgb(87, 26, 169)', 'rgb(212, 83, 1)'];
            const color = colors[index % colors.length];
            this.option.data.push({
              click: (item) => {