zouyu
2023-11-13 5381292617ad40f2fc7a9266ceb964a672d25a5a
src/views/basic/param/index.vue
@@ -17,7 +17,7 @@
            <el-form-item class="btn-group">
              <el-button type="" @click="onSearch">查询</el-button>
              <el-button type="primary" @click="addOrUpdateHandle">新增</el-button>
              <el-button @click="showImportDialog">导入</el-button>
              <el-button type="primary" @click="showImportDialog">导入</el-button>
            </el-form-item>
          </el-col>
        </el-row>
@@ -173,16 +173,31 @@
    ...mapGetters(['permissions'])
  },
  created() {
    this.loading = true
    this.getData()
    this.getParamType()
  },
  beforeUpdate() {
    console.log("updated");
    this.rowSort()
    this.rowCalc()
    this.loading = false
  },
  watch: {},
  // beforeUpdate() {
  //   console.log("updated");
  //   this.rowSort()
  //   this.rowCalc()
  //   this.loading = false
  // },
  watch: {
    tableData:{
            handler(old,newval){
                this.loading = true
                // this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
                this.rowSort()
                this.rowCalc()
                this.loading = false
            },
            deep: true
        }
  },
  methods: {
    //下载模板
    downloadTemplate() {
@@ -267,32 +282,42 @@
      this.option.column.forEach(item => {
        if (row.paramItemThree == "" && item.prop == 'paramItemThree') {
          item.display = false
        }else if(row.paramItemThree != "" && item.prop == 'paramItemThree'){
          item.display = true
        }
        if (row.paramItemTwo == "" && item.prop == 'paramItemTwo') {
          item.display = false
        }else if(row.paramItemTwo != "" && item.prop == 'paramItemTwo'){
          item.display = true
        }
      })
      console.log(row);
      // let type=this.typeOptions.filter(t=>{
      //   return t.label==row.paramType
      // })[0]
      // row.paramType=type.value
      this.$refs.crud.rowEdit(row, index)
    },
    showDel(row, index) {
      this.$refs.crud.rowDel(row, index)
    },
    updateParam(row, index, done, loading) {
      // console.log(row);
      // this.formDisabled = true
      let data = {
        dict: '',
        id: 0,
        id: '',
        parameterFormat: '',
        parameterItem: '',
        type: row.paramType,
        unit: row.unit,
      }
      row.paramType == '2' ? data.dict = row.paramFormat : data.parameterFormat = row.paramFormat
      if (row.threeId) {
      if (row.threeId!="null") {
        data.id = row.threeId
        data.parameterItem = row.paramItemThree
      } else {
        if (row.twoId) {
        if (row.twoId!="null") {
          data.id = row.twoId
          data.parameterItem = row.paramItemTwo
        } else {
@@ -300,7 +325,14 @@
          data.parameterItem = row.paramItem
        }
      }
      console.log(data)
      if(data.type=='文本格式'){
        let type=this.typeOptions.filter(t=>{
        return t.label==row.paramType
      })[0]
      data.type=type.value
      }
      // console.log(data);
      // return
      putObj(data).then(res => {
        if (res.data.data.code == 0) {
          this.$message.success("更新成功")
@@ -353,6 +385,7 @@
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      console.log("1111",row);
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(row == null ? null : row.id)
@@ -442,9 +475,9 @@
</script>
<style>
.grid-header {
/* .grid-header {
  display: none;
}
} */
.param-basic {
  margin: 0 10px;