zhangyanpeng
2024-03-04 6a72e9e44dc7278e18d55ccd5637b81a1cb2f047
src/views/common/process/config/ApprovalNodeConfig.vue
@@ -11,8 +11,8 @@
      <el-form-item label="⚙ 选择审批组或审批架构" prop="text" class="user-type">
        <el-select @change="selected(this,'staff')" value-key="id" style="width: 80%;" size="small"
                   v-model="nodeProps.staffGroup" placeholder="请选择审批架构">
          <el-option v-for="staffApprovals in staffGroups" :label="staffApprovals.name" :value="staffApprovals"
                     :key="staffApprovals.id"></el-option>
          <el-option v-for="staff in staffGroups" :label="staff.name" :value="staff"
                     :key="staff.id"></el-option>
        </el-select>
      </el-form-item>
      <el-divider></el-divider>
@@ -66,16 +66,12 @@
        </div>
      </el-form-item>
    </el-form>
    <org-picker :title="pickerTitle" multiple :type="orgPickerType" ref="orgPicker" :selected="orgPickerSelected"
                @ok="selected"/>
  </div>
</template>
<script>
import OrgPicker from "@/components/common/OrgPicker";
import {getDict, getEntitySet} from "@/api/design";
export default {
  name: "ApprovalNodeConfig",
  components: {OrgPicker},
  props: {
    config: {
      type: Object,
@@ -88,7 +84,6 @@
    return {
      showOrgSelect: false,
      orgPickerSelected: [],
      orgPickerType: 'user',
      groupNames: ['1', '2', '3', '4', '6', 'F', 'G', 'H', 'I', 'J'],
      approvalGroups: [
      ],
@@ -123,24 +118,13 @@
      return this.$store.state.selectedNode
    },
    nodeProps() {
      return this.$store.state.selectedNode.props
    },
    select() {
      console.log("this.config--select", this.config)
      return this.config.assignedUser
    },
    pickerTitle() {
      switch (this.orgPickerType) {
        case 'user':
          return '请选择人员';
        case 'role':
          return '请选择系统角色';
        default:
          return null;
      }
    },
  },
  mounted() {
    this.getApprovalGroup();
@@ -157,29 +141,28 @@
      let template = {"code": "position_sales"}
      getDict(template).then(rsp => {
        this.staffGroups = this.$Utils.decode(rsp.data.data.dictionary.items)
        this.staffGroups.forEach(item => item.name = item.value);
        this.staffGroups.forEach(item => item.id = item.code);
        this.staffGroups.forEach(item => {
          item.name = item.value
          item.id = item.code
        });
        // this.staffGroups.forEach(item => );
      }).catch(err => this.$message.error('获取审批流程异常'))
    },
    //如果切换选箱不是指定节点  那就把之前选择的指定节点信息 给清除掉 避免提交上去
    setValue() {
      if (this.nodeProps.refuse.type !== 'TO_NODE') {
        this.nodeProps.refuse.target = '';
      }
    },
    delGroup(index) {
      this.selectedNode.props.groups.splice(index, 1)
    },
    addConditionGroup() {
      console.log("this.config", this.config)
      this.config.groups.push({
      })
    },
    selected(select, type) {
      console.log("输出选中select", this.nodeProps)
      this.nodeProps.assignedUser = []
      if (type === 'group') {
        this.nodeProps.staffGroup = {}
        this.nodeProps.assignedUser.push({
@@ -197,9 +180,7 @@
            }
        )
      }
      console.log("assignedUser", this.config)
      console.log("this.config.props", this.config)
      this.orgPickerSelected.length = 0
    },
    removeOrgItem(index) {
      this.select.splice(index, 1)