田源
2023-12-04 dc3531814c2cfbf6d42065972abd5278e9afa086
Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue
@@ -101,14 +101,30 @@
      </el-table>
    </el-main>
    <el-footer>
      <div style="width: 260px; display: flex; align-items: center;margin-top: 5px">
      <div style="width: 460px; display: flex; align-items: center;margin-top: 5px">
        <p>值:</p>
        <el-input v-model="characterValue" size="small" style="flex: 1;"></el-input>
        <el-input v-model="characterValue" size="small" style="flex: 1; display: flex;">
          <template slot="prefix">
            <div style="display: flex; align-items: center;height: 100%;text-align: center;margin-left: 5px">
              <el-tag v-for="(item,index) in this.editValueList" :key="index" closable size="small"
                      @close="handleClose(item,index)">
                {{ item }}
              </el-tag>
            </div>
          </template>
        </el-input>
      </div>
    </el-footer>
    <el-dialog :visible.sync="editVisble" append-to-body title="修改可用字符" width="40%">
      <el-input v-model="characterValue" size="small"></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editVisble = false">取 消</el-button>
        <el-button type="primary" @click="editSaveHandler">确 定</el-button>
  </span>
    </el-dialog>
    <div style="margin-bottom: 10px;text-align: center">
      <el-button icon="el-icon-plus" plain size="small" type="success" @click="addSaveHandler">添加</el-button>
      <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editSaveHandler">修改</el-button>
      <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editDialog">修改</el-button>
      <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delSaveHandler">删除</el-button>
    </div>
  </basic-container>
@@ -119,10 +135,11 @@
import {gridCodeRule} from "@/api/code/codeCharcter"
export default {
  name: "paddingCharacter",
  name: "usableCharacter",
  data() {
    return {
      loading: false,
      editValueList: [],
      //下拉框数组
      queryReleasedList: [],
      //下拉框初始数据数组
@@ -131,7 +148,8 @@
      characterEditOldValue: "",
      tableData: [],
      select: "",
      selectValue: ""
      selectValue: "",
      editVisble: false
    }
  },
  watch: {
@@ -145,9 +163,32 @@
    this.getCodeRule();
  },
  methods: {
    editDialog(){
      if(this.editValueList.length > 1){
        this.$message.warning('只能选择一条数据!');
        return;
      }
      if(this.editValueList.length === 0){
        this.$message.warning('请选择一条数据!');
        return;
      }
      this.editVisble = true;
    },
    handleClose(tag, index) {
      this.$delete(this.editValueList, index);
      if (this.editValueList.length === 0) {
        this.characterValue = "";
        return;
      }
    },
    cellClickHandler(row, column) {
      this.characterValue = row[column.property];
      this.characterEditOldValue = row[column.property]
      this.characterEditOldValue = row[column.property];
      if (this.editValueList.includes(row[column.property])) {
        this.$message.warning('请检查字符集是否有重复!')
      } else {
        this.editValueList.push(row[column.property]);
      }
    },
    async getCodeRule() {
      try {
@@ -160,14 +201,12 @@
        const res2 = await getList({codeRuleId: this.select, chartType: "fillerChar", chartValue: this.characterValue});
        this.tableData = res2.data.data;
        this.loading = false;
        // console.log("this.tableData", this.tableData);
      } catch (error) {
        this.$message.warning(error)
      }
    },
    //编码规则下拉框搜索
    filterValue(query) {
      console.log(query)
      if (query !== "") {
        this.queryReleasedList = this.characterReleasedList.filter(item => {
          return item.name.includes(query.toString());
@@ -196,12 +235,14 @@
        this.$message.warning('请填写要添加的值!');
        return; // 判断输入值
      }
      if (this.editValueList.length != 0) {
        this.$message.warning('请先取消已选择的值!');
        return; // 判断输入值
      }
      const targetObject = this.characterReleasedList.find(obj => obj.oid === this.select);
      if (!targetObject) {
        return; // 查找对应typeText
      }
      const codeRuleCharacterVO = {
        codeRuleId: this.select,
        chartType: "fillerChar",
@@ -246,6 +287,8 @@
        .then(res => {
          this.$message.success(res.data.msg);
          this.characterValue = "";
          this.editVisble = false;
          this.editValueList = [];
          this.getTableData();
        }).catch(error => {
        this.$message.error('修改失败');
@@ -262,16 +305,18 @@
      if (!targetObject) {
        return; // 查找对应typeText
      }
      const value = this.editValueList.join("");
      const codeRuleCharacterVO = {
        codeRuleId: this.select,
        chartType: "fillerChar",
        chartValue: this.characterValue,
        chartValue: value,
        chartTypeText: targetObject.name
      };
      deleteSave(codeRuleCharacterVO)
        .then(res => {
          this.$message.success(res.data.msg);
          this.editValueList = [];
          this.characterValue = "";
          this.getTableData();
        }).catch(error => {