Browse Source

任务流程

ZaiZai 1 year ago
parent
commit
d2bfc511b7
2 changed files with 65 additions and 36 deletions
  1. 34 19
      src/views/debit-pay/material/order.vue
  2. 31 17
      src/views/debit-pay/start-work/order.vue

+ 34 - 19
src/views/debit-pay/material/order.vue

@@ -8,11 +8,11 @@
             </div>
         </template>
         <template #extra>
-            <el-button hc-btn type="primary" @click="addModalClick">
+            <el-button hc-btn type="primary" :disabled="approveStatus !== 0" @click="addModalClick">
                 <HcIcon name="add" />
                 <span>新增</span>
             </el-button>
-            <el-button hc-btn type="primary" @click="reportClick">
+            <el-button hc-btn type="primary" :disabled="approveStatus !== 0" @click="reportClick">
                 <HcIcon name="send-plane-2" />
                 <span>上报</span>
             </el-button>
@@ -28,8 +28,8 @@
                         @row-click="hanleRow"
                     >
                         <template #action="{ row }">
-                            <el-link type="success" @click="rowEditClick(row)">修改</el-link>
-                            <el-link type="danger" @click="delRowClick(row)">删除</el-link>
+                            <el-link type="success" :disabled="approveStatus !== 0" @click="rowEditClick(row)">修改</el-link>
+                            <el-link type="danger" :disabled="approveStatus !== 0" @click="delRowClick(row)">删除</el-link>
                         </template>
                     </hc-table>
                     <template #action>
@@ -90,7 +90,7 @@
                         <template v-if="infoData?.fileList?.length > 0">
                             <el-check-tag v-for="item in infoData?.fileList" :key="item.id" checked class="mr-2" @click="viewFile(item)">{{ item.fileName }}</el-check-tag>
                         </template>
-                       
+
                         <HcNoData v-else />
                     </div>
                 </hc-card-item>
@@ -100,7 +100,7 @@
         <HcDataModal v-model="isDataModal" :info-data="infoData" :ids="editId" @close="finishData" />
 
         <!-- 上报弹窗 -->
-        <hc-report-dialog v-model="isReport" />
+        <hc-report-dialog v-model="isReport" :info="reportInfo" @finish="reportFinish" />
     </hc-new-card>
 </template>
 
@@ -127,6 +127,7 @@ onMounted(async () => {
     await getKey1Data()
     getTableData()
 })
+
 //搜索表单
 const searchForm = ref({
     meterPeriodId: null, current: 1, size: 10, total: 0,
@@ -134,23 +135,26 @@ const searchForm = ref({
 
 //计量期
 const key1Data = ref([])
+const approveStatus = ref(0)
 const getKey1Data = async ()=>{
     const { error, code, data } = await periodApi.allPeriod({
        contractId:contractId.value,
-       type:1,
+       type: 1,
     })
     tableLoading.value = false
     if (!error && code === 200) {
-        key1Data.value = getArrValue(data)
-        if (key1Data.value.length > 0) {
-            searchForm.value.meterPeriodId = key1Data.value[key1Data.value.length - 1].id
-        }
-        
+        let newArr = getArrValue(data), info = getObjValue(newArr[newArr.length - 1])
+        searchForm.value.meterPeriodId = info.id
+        approveStatus.value = info.approveStatus
+        key1Data.value = newArr
     } else {
         key1Data.value = []
     }
 }
 const searchKey1Click = () => {
+    let info = getObjValue(key1Data.value.find((item) => item.id === searchForm.value.meterPeriodId))
+    approveStatus.value = info.approveStatus
+    searchForm.value.current = 1
     getTableData()
 }
 
@@ -187,8 +191,8 @@ const getTableData = async () => {
         searchForm.value.total = data['total']
         if (tableData.value.length > 0) {
             getDetail(tableData.value[0].id)
-          
-         
+
+
         } else {
             infoData.value = {}
         }
@@ -208,7 +212,7 @@ const getDetail = async (id)=>{
     })
     if (!error && code === 200) {
         infoData.value = getObjValue(data)
-   
+
     } else {
         infoData.value = {}
     }
@@ -219,7 +223,7 @@ const viewFile = (item)=>{
     if (filePdfUrl) {
         window.open(filePdfUrl, '_blank')
     }
-    
+
 }
 //表格选择
 const tableCheckChange = () => {
@@ -241,7 +245,7 @@ const editId = ref('')
 const rowEditClick = (row) => {
     isDataModal.value = true
     editId.value = row.id
-    
+
 }
 const delRowClick = async (row)=>{
     delMessageV2(async (action, instance, done) => {
@@ -257,19 +261,30 @@ const delRowClick = async (row)=>{
 }
 const removeProPay = async (id) => {
     const { error, code } = await mainApi.remove({
-        ids: id, 
+        ids: id,
     })
     if (!error && code === 200) {
         window?.$message?.success('删除成功')
        getTableData()
-     
+
     }
 }
+
 //是否上报
 const isReport = ref(false)
+const reportInfo = ref({})
 const reportClick = () => {
+    reportInfo.value = {
+        type: 2,
+        periodId: searchForm.value.meterPeriodId,
+    }
     isReport.value = true
 }
+
+//上报完成
+const reportFinish = () => {
+    window.location.reload()
+}
 </script>
 
 <style scoped lang="scss">

+ 31 - 17
src/views/debit-pay/start-work/order.vue

@@ -8,11 +8,11 @@
             </div>
         </template>
         <template #extra>
-            <el-button hc-btn type="primary" @click="addModalClick">
+            <el-button hc-btn type="primary" :disabled="approveStatus !== 0" @click="addModalClick">
                 <HcIcon name="add" />
                 <span>新增</span>
             </el-button>
-            <el-button hc-btn type="primary" @click="reportClick">
+            <el-button hc-btn type="primary" :disabled="approveStatus !== 0" @click="reportClick">
                 <HcIcon name="send-plane-2" />
                 <span>上报</span>
             </el-button>
@@ -26,8 +26,8 @@
                         is-current-row @selection-change="tableCheckChange" @row-click="hanleRow"
                     >
                         <template #action="{ row }">
-                            <el-link type="success" @click="rowEditClick(row)">修改</el-link>
-                            <el-link type="danger" @click="delRowClick(row)">删除</el-link>
+                            <el-link type="success" :disabled="approveStatus !== 0" @click="rowEditClick(row)">修改</el-link>
+                            <el-link type="danger" :disabled="approveStatus !== 0" @click="delRowClick(row)">删除</el-link>
                         </template>
                     </hc-table>
                     <template #action>
@@ -60,7 +60,7 @@
                         <template v-if="infoData?.fileList?.length > 0">
                             <el-check-tag v-for="item in infoData?.fileList" :key="item.id" checked class="mr-2" @click="viewFile(item)">{{ item.fileName }}</el-check-tag>
                         </template>
-                       
+
                         <HcNoData v-else />
                     </div>
                 </hc-card-item>
@@ -70,7 +70,7 @@
         <HcDataModal v-model="isDataModal" :info-data="infoData" :ids="editId" @close="finishData" />
 
         <!-- 上报弹窗 -->
-        <hc-report-dialog v-model="isReport" />
+        <hc-report-dialog v-model="isReport" :info="reportInfo" @finish="reportFinish" />
     </hc-new-card>
 </template>
 
@@ -98,8 +98,10 @@ onMounted(async () => {
 onActivated(() => {
     getKey1Data()
 })
+
 //计量期
 const key1Data = ref([])
+const approveStatus = ref(0)
 const getKey1Data = async ()=>{
     const { error, code, data } = await periodApi.allPeriod({
        contractId:contractId.value,
@@ -107,22 +109,24 @@ const getKey1Data = async ()=>{
     })
     tableLoading.value = false
     if (!error && code === 200) {
-        key1Data.value = getArrValue(data)
-        if (key1Data.value.length > 0) {
-            searchForm.value.meterPeriodId = key1Data.value[key1Data.value.length - 1].id
-        }
+        let newArr = getArrValue(data), info = getObjValue(newArr[newArr.length - 1])
+        searchForm.value.meterPeriodId = info.id
+        approveStatus.value = info.approveStatus
+        key1Data.value = newArr
     } else {
         key1Data.value = []
     }
 }
 //搜索表单
 const searchForm = ref({
-    key1: null, current: 1, size: 10, total: 0,
+    meterPeriodId: null, current: 1, size: 10, total: 0,
 })
 
 //计量期
-
 const searchKey1Click = () => {
+    let info = getObjValue(key1Data.value.find((item) => item.id === searchForm.value.meterPeriodId))
+    approveStatus.value = info.approveStatus
+    searchForm.value.current = 1
     getTableData()
 }
 
@@ -163,7 +167,7 @@ const getTableData = async () => {
     } else {
         tableData.value = []
         searchForm.value.total = 0
-       
+
     }
 }
 //获取详情
@@ -174,7 +178,7 @@ const getDetail = async (id)=>{
     })
     if (!error && code === 200) {
         infoData.value = getObjValue(data)
-   
+
     } else {
         infoData.value = {}
     }
@@ -185,7 +189,7 @@ const viewFile = (item)=>{
     if (filePdfUrl) {
         window.open(filePdfUrl, '_blank')
     }
-    
+
 }
 //表格选择
 const tableCheckChange = () => {
@@ -220,23 +224,33 @@ const delRowClick = async (row)=>{
 }
 const removeProPay = async (id) => {
     const { error, code } = await mainApi.remove({
-        ids: id, 
+        ids: id,
     })
     if (!error && code === 200) {
         window?.$message?.success('删除成功')
        getTableData()
-     
     }
 }
 const finishData = ()=>{
     isDataModal.value = false
     getTableData()
 }
+
 //是否上报
 const isReport = ref(false)
+const reportInfo = ref({})
 const reportClick = () => {
+    reportInfo.value = {
+        type: 3,
+        periodId: searchForm.value.meterPeriodId,
+    }
     isReport.value = true
 }
+
+//上报完成
+const reportFinish = () => {
+    window.location.reload()
+}
 </script>
 
 <style scoped lang="scss">