ZaiZai il y a 7 mois
Parent
commit
eab1033dbb

+ 22 - 14
src/views/debit-pay/material/components/material/dataModal.vue

@@ -10,7 +10,7 @@
                         </hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item prop="key1">
-                                <el-select v-model="formModel.meterPeriodId" placeholder="选择计量期" filterable block :disabled="!!dataId">
+                                <el-select v-model="formModel.meterPeriodId" placeholder="选择计量期" filterable block :disabled="!!dataId || isView">
                                     <template v-for="item in adjustment" :key="item.id">
                                         <template v-if="dataId">
                                             <el-option :label="item.periodNumber" :value="item.id" :disabled="item.approveStatus !== 0" />
@@ -31,7 +31,7 @@
                         </hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item prop="contractPeriodId">
-                                <el-select v-model="formModel.contractPeriodId" placeholder="选择调差期" filterable block :disabled="!!dataId" @change="adjustmentChange">
+                                <el-select v-model="formModel.contractPeriodId" placeholder="选择调差期" filterable block :disabled="!!dataId || isView" @change="adjustmentChange">
                                     <template v-for="item in adjustment" :key="item.id">
                                         <!-- el-option v-if="item.approveStatus === 2" :label="item.periodNumber" :value="item.id" / -->
                                         <el-option :label="item.periodNumber" :value="item.id" />
@@ -47,7 +47,7 @@
                         </hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item prop="contractMaterialId">
-                                <el-select v-model="formModel.contractMaterialId" placeholder="选择材料名称" filterable block :disabled="isNullES(formModel.contractPeriodId)" @change="materialNameChange">
+                                <el-select v-model="formModel.contractMaterialId" placeholder="选择材料名称" filterable block :disabled="isNullES(formModel.contractPeriodId) || isView" @change="materialNameChange">
                                     <el-option v-for="item in materialName" :key="item.id" :label="item.materialName" :value="item.id" />
                                 </el-select>
                             </el-form-item>
@@ -61,7 +61,11 @@
                                 <el-input v-model="formModel.currentPrice" disabled>
                                     <template #suffix>元</template>
                                     <template #append>
-                                        <el-button type="primary" class="hc-input-btn" color="#C99AD7" @click="realTimePriceClick">
+                                        <el-button v-if="isView" :disabled="isView">
+                                            <hc-icon name="add" />
+                                            <span>选择实时价格</span>
+                                        </el-button>
+                                        <el-button v-else type="primary" class="hc-input-btn" color="#C99AD7" @click="realTimePriceClick">
                                             <hc-icon name="add" />
                                             <span>选择实时价格</span>
                                         </el-button>
@@ -74,7 +78,7 @@
                         <hc-info-table-td is-title width="10%">调差月份:</hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item>
-                                <el-date-picker v-if="isAdjustDate" v-model="formModel.adjustMonth" class="block" type="month" format="YYYY-MM" value-format="YYYY-MM" :disabled="isNullES(formModel.currentPriceId)" :disabled-date="disabledDate" />
+                                <el-date-picker v-if="isAdjustDate" v-model="formModel.adjustMonth" class="block" type="month" format="YYYY-MM" value-format="YYYY-MM" :disabled="isNullES(formModel.currentPriceId) || isView" :disabled-date="disabledDate" />
                             </el-form-item>
                         </hc-info-table-td>
                         <hc-info-table-td is-title width="10%">材料基准价格:</hc-info-table-td>
@@ -125,28 +129,28 @@
             <el-divider border-style="dashed">
                 <el-segmented v-model="tab_key" :options="['材料明细', '上传附件']" />
             </el-divider>
-            <div v-if="tab_key === '材料明细'" class="loop-refresh-icon" @click="getMaterialDetail">
+            <div v-if="tab_key === '材料明细' && !isView" class="loop-refresh-icon" @click="getMaterialDetail">
                 <hc-icon name="loop-left" />
             </div>
-            <div v-if="tab_key === '材料明细'" class="computation-btn">
+            <div v-if="tab_key === '材料明细' && !isView" class="computation-btn">
                 <el-button size="small" color="#008200" @click="computationClick">计算</el-button>
             </div>
             <div v-if="tab_key === '材料明细'" class="table-body">
                 <hc-table :column="tableColumn1" :datas="tableData1" :index-style="{ width: 60 }" :loading="tableLoading1">
                     <template #changeTotal="{ row }">
-                        <el-input v-model="row.changeTotal" @blur="changeTotalBlur(row)" />
+                        <el-input v-model="row.changeTotal" :disabled="isView" @blur="changeTotalBlur(row)" />
                     </template>
                 </hc-table>
             </div>
             <div v-if="tab_key === '上传附件'" class="table-body">
                 <div class="table-upload-attachment">
-                    <el-button @click="uploadAttachmentClick">点击上传附件</el-button>
+                    <el-button :disabled="isView" @click="uploadAttachmentClick">点击上传附件</el-button>
                 </div>
                 <div class="table-upload">
                     <hc-table :column="tableColumn2" :datas="tableData2" :index-style="{ width: 60 }" :loading="tableLoading2">
                         <template #action="{ row, index }">
-                            <el-link type="primary" @click="previewFile(row)">预览</el-link>
-                            <el-link type="danger" @click="delFile(index)">删除</el-link>
+                            <el-link type="primary" :disabled="isView" @click="previewFile(row)">预览</el-link>
+                            <el-link type="danger" :disabled="isView" @click="delFile(index)">删除</el-link>
                         </template>
                     </hc-table>
                 </div>
@@ -154,7 +158,7 @@
         </div>
         <template #footer>
             <el-button hc-btn @click="modalClose">取消</el-button>
-            <el-button :loading="saveLoaing" hc-btn type="primary" @click="modalSave">保存</el-button>
+            <el-button v-if="!isView" :loading="saveLoaing" hc-btn type="primary" @click="modalSave">保存</el-button>
         </template>
     </hc-new-dialog>
     <!-- 材料实时发布价格 -->
@@ -195,6 +199,7 @@ import { deepClone, formValidate, getArrValue, getObjValue, isNullES, newWindow
 import BigNumber from 'bignumber.js'
 
 const props = defineProps({
+    view: Boolean,
     ids: {
         type: [String, Number],
         default: '',
@@ -222,9 +227,11 @@ const isShow = defineModel('modelValue', {
 //监听
 const dataId = ref(props.ids)
 const dataPid = ref(props.meterPeriodId)
-watch(() => [props.ids, props.meterPeriodId], ([id, pid]) => {
+const isView = ref(props.view)
+watch(() => [props.ids, props.meterPeriodId, props.view], ([id, pid, view]) => {
     dataId.value = id
     dataPid.value = pid
+    isView.value = view
 }, { deep: true })
 
 //监听
@@ -479,6 +486,7 @@ const tableColumn1 = [
 const tableData1 = ref([])
 const tableLoading1 = ref(false)
 const getMaterialDetail = async () => {
+    if (isView.value) return
     const {
         contractPeriodId, contractMaterialId, currentPrice,
         materialValidityId, materialPrice, rangePriceRatio,
@@ -549,7 +557,7 @@ const changeTotalBlur = (row) => {
 
 //计算
 const computationClick = async () => {
-    console.log('1111')
+    if (isView.value) return
     const isForm = await formValidate(formRef.value)
     if (!isForm) return
     if (tableData1.value.length <= 0) {

+ 6 - 3
src/views/debit-pay/material/material.vue

@@ -24,8 +24,7 @@
         </template>
         <hc-table :column="tableColumn" :datas="tableData" :index-style="{ width: 60 }" :loading="tableLoading">
             <template #materialName="{ row }">
-                <span v-if="row.approveStatus === 1">{{ row.materialName }}</span>
-                <el-link v-else type="primary" @click="rowTop(row)">{{ row.materialName }}</el-link>
+                <el-link type="primary" @click="rowTop(row)">{{ row.materialName }}</el-link>
             </template>
             <template #approveStatus="{ row }">
                 <span v-if="row.approveStatus === 1" class="text-green">已完结</span>
@@ -40,7 +39,7 @@
             <hc-pages :pages="searchForm" @change="pageChange" />
         </template>
         <!-- 新增/编辑 -->
-        <HcdataModal v-model="isFormModal" :meter-period-id="searchForm.contractPeriodId" :ids="rowId" @finish="dataModalFinish" />
+        <HcdataModal v-model="isFormModal" :meter-period-id="searchForm.contractPeriodId" :view="isView" :ids="rowId" @finish="dataModalFinish" />
     </hc-card>
 </template>
 
@@ -125,12 +124,15 @@ const isFormModal = ref(false)
 const rowId = ref('')
 const addFormModal = () => {
     rowId.value = ''
+    isView.value = false
     isFormModal.value = true
 }
 
 //材料名称被点击
+const isView = ref(false)
 const rowTop = (row) => {
     rowId.value = row.id
+    isView.value = true
     nextTick(() => {
         isFormModal.value = true
     })
@@ -139,6 +141,7 @@ const rowTop = (row) => {
 //编辑
 const rowEditClick = (row) => {
     rowId.value = row.id
+    isView.value = false
     nextTick(() => {
         isFormModal.value = true
     })