yangfeng
2024-02-28 983c6c7c026f6089fb4317dbff3a164e7c05aa8c
产品管理添加、编辑、删除相关组件数据处理
3个文件已修改
98 ■■■■■ 已修改文件
src/components/makepager/CommonFormTableView.vue 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/TableCommonView.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/service/serviceContract/AddServiceContractDialog.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/CommonFormTableView.vue
@@ -71,18 +71,18 @@
                  <div
                    v-if="scope.row[item.prop] && scope.row[item.prop].length > 0 && isOperate"
                    class="common-select-btn"
                    @click="handleEditClient(scope.row, item.prop)"
                    @click="handleEditClient(scope, item.prop)"
                  >
                    <i class="el-icon-edit" title="编辑"></i>
                  </div>
                  <div
                    v-if="scope.row[item.prop] && scope.row[item.prop].length > 0 && isOperate"
                    class="common-select-btn"
                    @click="clearupClient(scope.row)"
                    @click="clearupClient(scope)"
                  >
                    <i class="el-icon-remove-outline" title="清除"></i>
                  </div>
                  <div class="common-select-btn" v-else @click="selClientClick(scope.row, item.prop)">
                  <div class="common-select-btn" v-else @click="selClientClick(scope, item.prop)">
                    <i class="el-icon-circle-plus-outline" title="选择"></i>
                  </div>
                </div>
@@ -417,6 +417,7 @@
    // 新增
    add() {
      if (this.addTypeIdMultiple) {
        this.productIndex = this.tableList.tableData.length
        this.editSelCommonConfig.title = "产品名称"
        this.editSelCommonConfig.isSelectBox = true
        this.editSelCommonConfig.editVisible = true
@@ -508,43 +509,46 @@
      })
    },
    // 新增
    selClientClick(row, prop) {
      console.log(row, prop)
      this.productIndex = row.productId - 1
    selClientClick(scope, prop) {
      console.log(scope, prop)
      this.productIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.isSelectBox = true
      this.editSelCommonConfig.editVisible = true
    },
    // 编辑
    handleEditClient(row, prop) {
      console.log(row, prop)
      this.productIndex = row.productId - 1
    handleEditClient(scope, prop) {
      console.log(scope, prop)
      this.productIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.isSelectBox = false
      this.editSelCommonConfig.editVisible = true
    },
    selClient(item) {
      console.log(item)
      console.log(this.tableList.tableData)
      this.isRecalculate = true
      // this.editConfig.infomation.client_name = row.name
      this.tableList.tableData.map((ite, index) => {
        if (index === this.productIndex) {
          ite.name = item.name
          ite.amount = item.amount || 1
          ite.number = item.number
          ite.price = item.price
          ite.total = item.amount ? item.amount * item.price : 1 * item.price
          ite.unit = item.unit
        }
      })
      let list = this.tableList.tableData.map((item) => item.number)
      if (list.findIndex((v) => v == item.number) == -1) {
        this.isRecalculate = true
        // this.editConfig.infomation.client_name = row.name
        this.tableList.tableData.map((ite, index) => {
          if (index === this.productIndex) {
            ite.name = item.name
            ite.amount = item.amount || 1
            ite.number = item.number
            ite.price = item.price
            ite.total = item.amount ? item.amount * item.price : 1 * item.price
            ite.unit = item.unit
          }
        })
      } else {
        this.$message.error("不能选择重复的产品, 请重新选择")
      }
    },
    getSelectArray(val) {
      this.$emit("getSelectArray", val)
      this.$emit("getSelectArray", val, this.productIndex)
    },
    // 清除已选择用户
    clearupClient(row) {
      this.productIndex = row.productId - 1
    clearupClient(scope) {
      this.productIndex = scope.$index
      this.tableList.tableData.map((ite, index) => {
        if (index === this.productIndex) {
          ite.name = ""
src/components/makepager/TableCommonView.vue
@@ -398,35 +398,12 @@
      this.$emit("tableRowClassName", row)
    },
    selectable(row) {
      console.log(row, this.selectBoxList, "888899")
      let list = this.selectBoxList.map((item) => item.number)
      console.log(
        list,
        list.findIndex((v) => v == row.number)
      )
      if (list.findIndex((v) => v == row.number) == -1) {
        console.log("33")
        return true
      } else {
        console.log("44")
        return false
      }
      // if (this.selectBoxList.length == 1 && this.selectBoxList[0].number.length == 0) {
      //   return true
      // } else {
      //   let list = this.selectBoxList.map((item) => item.number)
      //   console.log(
      //     list,
      //     list.findIndex((v) => v === row.number),
      //     "5555"
      //   )
      //   if (list.findIndex((v) => v === row.number)) {
      //     return true
      //   } else {
      // }
      // }
    }
  }
}
src/views/service/serviceContract/AddServiceContractDialog.vue
@@ -840,19 +840,18 @@
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val) {
      // if (val.length > 0) {
      //   val.map((item, index) => {
      //     item.productId = this.tableData.length + index + 1
      //   })
      // }
      console.log(this.tableData, "ddddaaaqqq")
    getSelectArray(val, index) {
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        console.log("ssss")
        this.tableData = []
      }
      this.tableData = this.tableData.concat(val)
      console.log(this.tableData, "55555ddddaaaqqq")
      if (index < this.tableData.length) {
        this.tableData.splice(index, 1)
        val.map((item, ind) => {
          this.tableData.splice(index + ind, 0, item)
        })
      } else {
        this.tableData = this.tableData.concat(val)
      }
      this.productTableList.tableData = this.tableData
      this.showSummary.show = true
    },