<template>
  <div> </div>
</template>

<script>
import components from './_import-components/xm-iam-modify-cpmqrzt-handler-import'

export default {
  name: 'XmIamModifyCpmqrztHandler',
  components: {
    ...components,
  },
  data() {
    return {
      visible: false,
      button: {},
      initValues: [],
      childTable: undefined,
      selectedRows: [],
    }
  },
  methods: {
    run({ button, eventScript, context: { childTable, selectedRows } }) {
      this.button = button
      this.childTable = childTable
      this.selectedRows = selectedRows
      // 根据需修改的字段，获取字段信息
      const modifyField = eventScript.fieldName
      // 将修改的数据更新到记录中
      const modifyData = {}
      modifyData[modifyField] = eventScript.fieldValue
      this.selectedRows.forEach((r) => {
        Object.assign(r, modifyData)
        this.childTable.setRowValueById(r.id, r)
      })
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
