소스 검색

抽检记录是否可以更改

duy 1 년 전
부모
커밋
cd07b7022b
2개의 변경된 파일27개의 추가작업 그리고 8개의 파일을 삭제
  1. 10 3
      src/views/transfer/components/conclusion/table-score.vue
  2. 17 5
      src/views/transfer/writing-conclusion.vue

+ 10 - 3
src/views/transfer/components/conclusion/table-score.vue

@@ -25,10 +25,10 @@
             <span v-else>{{ row.normative || '-' }}</span>
         </template>
         <template #action="{ row }">
-            <el-button v-if="row.isEdit" type="success" size="small" @click="saveClick(row)">
+            <el-button v-if="row.isEdit" type="success" size="small" :diasbled="state" @click="saveClick(row)">
                 保存
             </el-button>
-            <el-button v-else type="primary" size="small" @click="editClick(row)">
+            <el-button v-else type="primary" size="small" :disabled="state" @click="editClick(row)">
                 编辑
             </el-button>
         </template>
@@ -55,18 +55,25 @@ const props = defineProps({
         type: [String, Number],
         default: '',
     },
+    state:{
+        type:Boolean,
+        default:false, //是否可以编辑
+    },
 })
 
 //变量
 const projectId = ref(props.projectId)
 const contractId = ref(props.contractId)
+const state = ref(props.state)
 const typeId = ref(props.type)
 
 //监听
 watch(() => [
     props.type,
-], ([type]) => {
+    props.state,
+], ([type, sta]) => {
     typeId.value = type
+    state.value = sta
     getTotalData()
 })
 

+ 17 - 5
src/views/transfer/writing-conclusion.vue

@@ -39,7 +39,7 @@
                                 </el-select>
                             </div>
                         </template>
-                        <TableScore :contract-id="contractId" :project-id="projectId" :type="searchFormScore.unitType" />
+                        <TableScore :contract-id="contractId" :project-id="projectId" :type="searchFormScore.unitType" :state="state" />
                     </HcCardItem>
                 </el-container>
                 <el-aside id="hc_table_aside" class="hc-table-aside">
@@ -61,8 +61,8 @@
                         <el-input v-model="opinionText" style="flex: 1;" :rows="3" placeholder="请输入抽检意见" type="textarea" resize="none" />
                         <el-button class="ml-4" hc-btn type="primary" :loading="submitLoading" @click="opinionTextEditHihe">保存</el-button>
                     </div>
-                    <div v-if="!opinionTextEdit" class="text-blue text-hover icon-1" @click="opinionTextEditShow">
-                        <HcIcon name="edit-2" />
+                    <div v-if="!opinionTextEdit " class="text-blue text-hover icon-1" @click="opinionTextEditShow">
+                        <HcIcon v-if="!state" name="edit-2" />
                     </div>
                 </div>
             </div>
@@ -97,8 +97,11 @@ const projectInfo = ref(useAppState.getProjectInfo)
 onMounted(() => {
     setSplitRef()
     getScore()
+   
+})
+onActivated(()=>{
+    getStatus()
 })
-
 //初始化设置拖动分割线
 const setSplitRef = () => {
     //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
@@ -115,7 +118,16 @@ const setSplitRef = () => {
         })
     }, 800)
 }
-
+//获取是否可以修改
+const state = ref(false)
+const getStatus = async ()=>{
+    const { error, code, data } = await initialgApi.getTable({
+        projectId: projectId.value,
+    })
+    if (!error && code === 200) {
+        state.value = data['status'] === 2 ? true : false
+    } 
+}
 const searchFormScore = ref({
     unitType: '1', score: false,
 })