祖安之光
2025-07-10 13c0b3f07e75d63ffb518ee8f3af81b3e8a1caa3
src/views/build/conpanyFunctionConsult/orgStructure/departManage/components/dutyDialog.vue
@@ -70,13 +70,9 @@
                v-model.trim="scope.row.clauseNum"
                size="large"
                type="textarea"
                v-if="scope.$index>4 && scope.$index<state.form.sysDeptResponsibilityList.length-2"
                style="width: 100%;"
            >
            </el-input>
            <span v-else>
              {{scope.row.clauseNum}}
            </span>
          </template>
        </el-table-column>
        <el-table-column label="内容" prop="content" align="center">
@@ -85,13 +81,9 @@
                v-model.trim="scope.row.content"
                size="large"
                type="textarea"
                v-if="scope.$index>4 && scope.$index<state.form.sysDeptResponsibilityList.length-2"
                style="width: 100%;"
            >
            </el-input>
            <span v-else>
              {{scope.row.content}}
            </span>
          </template>
        </el-table-column>
        <el-table-column label="条款负责人" prop="leader" align="center">
@@ -166,7 +158,7 @@
        <el-table-column label="操作" align="center" width="70">
          <template #default="scope">
<!--            <el-button link type="primary" @click="openEdit('edit',scope.row)">编辑</el-button>-->
            <el-button link type="danger" v-if="scope.$index>4 && scope.$index<state.form.sysDeptResponsibilityList.length-2" @click="handleDelete(scope.$index)">删除</el-button>
            <el-button link type="danger" @click="handleDelete(scope.$index)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -206,17 +198,6 @@
    // internalAuditors: [{ required: true, message: '请选择内审员', trigger: 'blur' }],
    responsibilities: [{ required: true, message: '请输入部门职责', trigger: 'blur' }]
  },
  firstFive: [
    {clauseNum: '5.3',content: '组织的岗位、职责和权限'},
    {clauseNum: '4.1',content: '理解组织及其环境'},
    {clauseNum: '4.2',content: '理解相关方的需求和期望'},
    {clauseNum: '6.1',content: '应对风险和机遇的措施'},
    {clauseNum: '6.2',content: '质量目标及其实现的策划'}
  ],
  lastTwo: [
    {clauseNum: '9.1',content: '监视、测量、分析和评价'},
    {clauseNum: '10',content: '改进'}
  ],
  userList: []
})
@@ -239,13 +220,8 @@
          state.form[key] = res.data[key];
        }
      })
      if(res.data.sysDeptResponsibilitys && Array.isArray(res.data.sysDeptResponsibilitys) && res.data.sysDeptResponsibilitys.find(i=>i.clauseNum == '5.3')){
        state.form.sysDeptResponsibilityList = sortResponsibilities(res.data.sysDeptResponsibilitys)
        state.oldResponsibilityList = sortResponsibilities(res.data.sysDeptResponsibilitys)
      }else{
        state.form.sysDeptResponsibilityList = [...state.firstFive,...res.data.sysDeptResponsibilitys,...state.lastTwo]
        state.oldResponsibilityList = [...state.firstFive,...res.data.sysDeptResponsibilitys,...state.lastTwo]
      }
      state.form.sysDeptResponsibilityList = res.data.sysDeptResponsibilitys
      state.oldResponsibilityList = res.data.sysDeptResponsibilitys
      state.form.personNum = state.form.personNum==0?null:state.form.personNum
      state.form.internalAuditors = state.form.internalAuditors==0?null:state.form.internalAuditors
    }else{
@@ -254,43 +230,6 @@
  } else {
    ElMessage.warning(res.message)
  }
}
const sortResponsibilities = (list) => {
  // 提取firstFive和lastTwo的clauseNum作为排序依据
  const firstFiveClauses = state.firstFive.map(item => item.clauseNum)
  const lastTwoClauses = state.lastTwo.map(item => item.clauseNum)
  // 分类处理
  const matchedFirstFive = []
  const matchedLastTwo = []
  const otherItems = []
  // 先匹配firstFive
  firstFiveClauses.forEach(clauseNum => {
    const foundItem = list.find(item => item.clauseNum === clauseNum)
    if (foundItem) {
      matchedFirstFive.push(foundItem)
    }
  });
  // 然后匹配lastTwo
  lastTwoClauses.forEach(clauseNum => {
    const foundItem = list.find(item => item.clauseNum === clauseNum)
    if (foundItem && !matchedFirstFive.includes(foundItem)) {
      matchedLastTwo.push(foundItem)
    }
  });
  // 剩下的其他项
  list.forEach(item => {
    if (!matchedFirstFive.includes(item) && !matchedLastTwo.includes(item)) {
      otherItems.push(item)
    }
  });
  // 合并结果数组
  return [...matchedFirstFive, ...otherItems, ...matchedLastTwo]
}
const getUserList = async ()=> {
@@ -312,7 +251,7 @@
    technicalDocuments: '',
    existingRecords: ''
  }
  state.form.sysDeptResponsibilityList.splice(-2, 0, obj);
  state.form.sysDeptResponsibilityList.push(obj);
}
const handleDelete = (i) =>{