吉安感知网项目-前端
chenyao
19 hours ago a53ece5036c1fa61a63fe5f9e0cd3519210ab928
applications/task-work-order/src/views/orderView/orderDataManage/evaluate/index.vue
@@ -19,6 +19,7 @@
               placeholder="请选择"
               clearable
               @change="handleSearch"
            >
               <el-option v-for="item in isResolvedOptions" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
@@ -30,11 +31,11 @@
         </el-form-item>
      </el-form>
      <div class="gd-table-toolbar">
         <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增评价</el-button>
      </div>
      <div class="gd-table-container" v-loading="loading">
         <div class="gd-table-toolbar">
            <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增评价</el-button>
         </div>
         <div class="gd-table-content gd-table-content-bg">
            <el-table class="gd-table" :data="list">
               <el-table-column label="序号" width="80">
@@ -53,7 +54,7 @@
                  </template>
               </el-table-column>
               <el-table-column prop="evaluationContent" show-overflow-tooltip label="评价内容" />
               <el-table-column label="操作" class-name="operation-btns" width="150">
               <el-table-column label="操作" class-name="operation-btns" width="150" fixed="right">
                  <template v-slot="{ row }">
                     <el-link  type="primary"  @click="openForm('view', row)">查看</el-link>
                     <el-link  type="primary"  @click="openForm('edit', row)" v-if="row.isTheSameDepartment">编辑</el-link>
@@ -80,7 +81,6 @@
</template>
<script setup>
import { Search, RefreshRight, Plus, Delete } from '@element-plus/icons-vue'
import { onMounted, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getDeptTree } from '@/api/system/dept'
import FormDiaLog from './FormDiaLog.vue'
@@ -91,12 +91,15 @@
import { useStore } from 'vuex'
const store = useStore()
const userDepartment = store.state.user.userInfo?.dept_id
const permission = computed(() => store.state.user.permission);
const userInfo = computed(() => store.state.user.userInfo)
// 初始化查询参数
const initSearchParams = () => ({
   title: '', // 标题
   isResolved: '', // 是否解决
   current: 1, // 当前页
   size: 10, // 每页大小
   isQueryAll:''//是否查询所有
})
const searchParams = ref(initSearchParams()) // 查询参数
const total = ref(0) // 总条数
@@ -110,10 +113,16 @@
   label: 'name',
   children: 'children',
}
const isResolvedOptions = [
   { label: '否', value: '0' },
   { label: '是', value: '1' },
]
const isResolvedOptions = computed(() => {
   if (permission.value.sjyy_shtg && userInfo.value.role_name !== 'administrator') {
      return [{ label: '是', value: '1' }]
   } else {
      return [
         { label: '否', value: '0' },
         { label: '是', value: '1' },
      ]
   }
})
provide('deptTree', deptTree)
provide('treeProps', treeProps)
provide('isResolvedOptions', isResolvedOptions)
@@ -122,7 +131,19 @@
async function getList() {
   loading.value = true
   try {
      const res = await gdDataEvaluationPageApi(searchParams.value)
      // 根据权限设置查询参数
      const params = { ...searchParams.value }
      if (permission.value.sjyy_shtg && userInfo.value.role_name !== 'administrator') {
         params.isQueryAll = true
         params.isResolved = '1'
         console.log('params',params);
      } else {
         params.isQueryAll = false
         // delete params.isResolved
      }
      const res = await gdDataEvaluationPageApi(params)
      res?.data?.data?.records.forEach(item => {   
         item.isTheSameDepartment = String(item.createDept) === String(userDepartment)
      })