Просмотр исходного кода

网页端:整体统计新增环比和同比

余思翰 1 неделю назад
Родитель
Сommit
f03fc00b2f

+ 7
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcBorrowMapper.xml Просмотреть файл

@@ -141,7 +141,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
141 141
             <if test="dszTime != null "> and b.dsz_time = #{dszTime}</if>
142 142
             <if test="lendTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', lendTime) == '2000' "> and b.lend_time is not null</if>
143 143
             <if test="lendTime != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', lendTime) != '2000' "> and YEAR(b.lend_time) = YEAR(#{lendTime})</if>
144
-            <if test="params.beginTime != null and params.beginTime != ''"> and MONTH(b.lend_time) = MONTH(#{lendTime})</if>
144
+            <if test="params.beginTime != null and params.beginTime != '' and lendTime != null"> and MONTH(b.lend_time) = MONTH(#{lendTime})</if>
145
+            <if test="params.beginTime != null and params.beginTime != '' and lendTime == null">
146
+                and date_format(b.apply_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
147
+            </if>
148
+            <if test="params.endTime != null and params.endTime != '' and lendTime == null">
149
+                and date_format(b.apply_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
150
+            </if>
145 151
             <if test="unionTime != null "> and b.union_time = #{unionTime}</if>
146 152
         </where>
147 153
         order by b.apply_date desc

+ 6
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcContractMapper.xml Просмотреть файл

@@ -166,6 +166,12 @@
166 166
             <if test="projectSource != null  and projectSource != ''"> and p.project_source = #{projectSource}</if>
167 167
             <if test="projectName != null  and projectName != ''"> and p.project_name like concat('%', #{projectName}, '%')</if>
168 168
             <if test="partyAName != null  and partyAName != ''"> and pa.party_a_name like concat('%', #{partyAName}, '%')</if>
169
+            <if test="params.beginTime != null and params.beginTime != ''">
170
+                and date_format(t1.sign_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
171
+            </if>
172
+            <if test="params.endTime != null and params.endTime != ''">
173
+                and date_format(t1.sign_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
174
+            </if>
169 175
         </where>
170 176
         group by t1.contract_id
171 177
         order by t1.draft_time desc

+ 5
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcDeviceApprovalMapper.xml Просмотреть файл

@@ -83,7 +83,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
83 83
             <if test="applyReason != null  and applyReason != ''"> and da.apply_reason = #{applyReason}</if>
84 84
             <if test="applyDate != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', applyDate) == '2000' "> and da.apply_date is not null</if>
85 85
             <if test="applyDate != null and @com.ruoyi.common.utils.DateUtils@parseDateToStr('yyyy', applyDate) != '2000' "> and YEAR(da.apply_date) = YEAR(#{applyDate})</if>
86
-            <if test="params.beginTime != null and params.beginTime != ''"> and MONTH(da.apply_date) = MONTH(#{applyDate})</if>
86
+            <if test="params.beginTime != null and params.beginTime != '' and applyDate != null"> and MONTH(da.apply_date) = MONTH(#{applyDate})</if>
87
+            <if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != '' and applyDate == null">
88
+                and date_format(da.begin_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
89
+                and date_format(da.end_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
90
+            </if>
87 91
             <if test="returnDate != null "> and da.return_date = #{returnDate}</if>
88 92
             <if test="beginDate != null "> and da.begin_date = #{beginDate}</if>
89 93
             <if test="endDate != null "> and da.end_date = #{endDate}</if>

+ 6
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcProjectMapper.xml Просмотреть файл

@@ -131,6 +131,12 @@
131 131
             <if test="entryTime != null "> and p.entry_time = #{entryTime}</if>
132 132
             <if test="exitTime != null "> and p.exit_time = #{exitTime}</if>
133 133
             <if test="participates != null  and participates != ''"> and find_in_set(#{participates}, p.participates)</if>
134
+            <if test="params.beginTime != null and params.beginTime != ''">
135
+                and date_format(p.register_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
136
+            </if>
137
+            <if test="params.endTime != null and params.endTime != ''">
138
+                and date_format(p.register_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
139
+            </if>
134 140
         </where>
135 141
         group by p.project_id
136 142
         order by p.register_time desc, p.project_number desc

+ 315
- 298
oa-ui/src/views/flowable/form/finance/borrowForm.vue Просмотреть файл

@@ -12,347 +12,360 @@
12 12
         </div>
13 13
         <el-form ref="form" :model="form" :rules="rules" class="borrow-table-form">
14 14
           <div class="form-table-wrap">
15
-          <table class="form-table">
16
-            <tr>
17
-              <td colspan="2" class="label-cell">申请人</td>
18
-              <td colspan="2">
19
-                <el-form-item prop="user.nickName" class="table-form-item">
20
-                  {{ form.applierUser ? form.applierUser.nickName : form.user.nickName }}
21
-                </el-form-item>
22
-              </td>
23
-              <td colspan="2" class="label-cell">申请部门</td>
24
-              <td colspan="2">
25
-                <el-form-item prop="dept.deptName" class="table-form-item">
26
-                  {{ form.dept.deptName }}
27
-                </el-form-item>
28
-              </td>
29
-              <td colspan="2" class="label-cell">申请日期</td>
30
-              <td colspan="2">
31
-                <el-form-item prop="date" class="table-form-item">
32
-                  <el-date-picker style="width: 100%;" v-model="form.applyDate" value-format="yyyy-MM-dd" type="date"
33
-                    placeholder="选择日期" disabled>
34
-                  </el-date-picker>
35
-                </el-form-item>
36
-              </td>
37
-            </tr>
38
-
39
-            <template v-if="taskForm.procDefName == '借款审批'">
15
+            <table class="form-table">
40 16
               <tr>
41
-                <td colspan="2" class="label-cell">借款类型</td>
42
-                <td colspan="10">
43
-                  <el-form-item prop="borrowUsage" class="table-form-item">
44
-                    <el-radio-group v-model="form.borrowUsage" @change="hanldeChangeType" :disabled="taskName != '借款申请'">
45
-                      <el-radio label="0">项目借款</el-radio>
46
-                      <el-radio label="1">非项目借款</el-radio>
47
-                      <el-radio label="2">工会借款</el-radio>
48
-                      <el-radio label="3">党委借款</el-radio>
49
-                      <el-radio label="4">团委借款</el-radio>
50
-                    </el-radio-group>
17
+                <td colspan="2" class="label-cell">申请人</td>
18
+                <td colspan="2">
19
+                  <el-form-item prop="user.nickName" class="table-form-item">
20
+                    {{ form.applierUser ? form.applierUser.nickName : form.user.nickName }}
51 21
                   </el-form-item>
52 22
                 </td>
53
-              </tr>
54
-              <tr v-if="!isProject">
55
-                <td colspan="2" class="label-cell">借款事由</td>
56
-                <td colspan="10">
57
-                  <el-form-item prop="applyReason" class="table-form-item">
58
-                    <el-input v-model="form.applyReason" :disabled="taskName != '借款申请'"></el-input>
23
+                <td colspan="2" class="label-cell">申请部门</td>
24
+                <td colspan="2">
25
+                  <el-form-item prop="dept.deptName" class="table-form-item">
26
+                    {{ form.dept.deptName }}
27
+                  </el-form-item>
28
+                </td>
29
+                <td colspan="2" class="label-cell">申请日期</td>
30
+                <td colspan="2">
31
+                  <el-form-item prop="date" class="table-form-item">
32
+                    <el-date-picker style="width: 100%;" v-model="form.applyDate" value-format="yyyy-MM-dd" type="date"
33
+                      placeholder="选择日期" disabled>
34
+                    </el-date-picker>
59 35
                   </el-form-item>
60 36
                 </td>
61 37
               </tr>
62
-              <template v-if="isProject">
38
+
39
+              <template v-if="taskForm.procDefName == '借款审批'">
63 40
                 <tr>
64
-                  <td colspan="2" class="label-cell">项目信息</td>
41
+                  <td colspan="2" class="label-cell">借款类型</td>
65 42
                   <td colspan="10">
66
-                    <el-button type="primary" size="mini" @click="openProject = true" v-if="taskName == '借款申请'">选择项目</el-button>
67
-                    <template v-if="isSelect">
68
-                      <table class="inner-table">
69
-                        <tr>
70
-                          <td class="label-cell">项目编号</td>
71
-                          <td>{{ chooseProject.projectNumber }}</td>
72
-                          <td class="label-cell">项目名称</td>
73
-                          <td>{{ chooseProject.projectName }}</td>
74
-                        </tr>
75
-                        <tr>
76
-                          <td class="label-cell">项目负责人</td>
77
-                          <td>{{ chooseProject.projectLeaderUser ? chooseProject.projectLeaderUser.nickName : '' }}</td>
78
-                          <td class="label-cell">承担部门</td>
79
-                          <td>{{ chooseProject.undertakingDeptName }}</td>
80
-                        </tr>
81
-                        <tr>
82
-                          <td class="label-cell">项目类型</td>
83
-                          <td colspan="3">{{ chooseProject.projectType }}</td>
84
-                        </tr>
85
-                      </table>
86
-                    </template>
87
-                    <el-form-item prop="projectId" class="table-form-item" style="display: none;"></el-form-item>
43
+                    <el-form-item prop="borrowUsage" class="table-form-item">
44
+                      <el-radio-group v-model="form.borrowUsage" @change="hanldeChangeType"
45
+                        :disabled="taskName != '借款申请'">
46
+                        <el-radio label="0">项目借款</el-radio>
47
+                        <el-radio label="1">非项目借款</el-radio>
48
+                        <el-radio label="2">工会借款</el-radio>
49
+                        <el-radio label="3">党委借款</el-radio>
50
+                        <el-radio label="4">团委借款</el-radio>
51
+                      </el-radio-group>
52
+                    </el-form-item>
88 53
                   </td>
89 54
                 </tr>
90
-              </template>
91
-            </template>
92
-
93
-            <tr>
94
-              <td colspan="2" class="label-cell">借款明细</td>
95
-              <td colspan="10">
96
-                <table class="inner-table detail-inner-table">
55
+                <tr v-if="!isProject">
56
+                  <td colspan="2" class="label-cell">借款事由</td>
57
+                  <td colspan="10">
58
+                    <el-form-item prop="applyReason" class="table-form-item">
59
+                      <el-input v-model="form.applyReason" :disabled="taskName != '借款申请'"></el-input>
60
+                    </el-form-item>
61
+                  </td>
62
+                </tr>
63
+                <template v-if="isProject">
97 64
                   <tr>
98
-                    <td class="label-cell" style="width: 50px;">序号</td>
99
-                    <td class="label-cell" style="min-width: 150px;">开支项目</td>
100
-                    <td class="label-cell">单位</td>
101
-                    <td class="label-cell">单价</td>
102
-                    <td class="label-cell">数量</td>
103
-                    <td class="label-cell">申请金额</td>
104
-                    <td class="label-cell" v-if="form.borrowUsage == 0 || form.borrowUsage == 1">分管领导审核金额</td>
105
-                    <td class="label-cell">操作</td>
106
-                  </tr>
107
-                  <tr v-for="(detail, index) in detailList" :key="index">
108
-                    <td>{{ index + 1 }}</td>
109
-                    <td>
110
-                      <el-select v-model="detail.borrowItem" placeholder="请选择开支项" clearable @change="handleExpenseChange"
111
-                        style="width: 100%;" :disabled="taskName != '借款申请'" v-if="form.borrowUsage == 0">
112
-                        <el-option v-for="dict in dict.type.cmc_borrow_expense" clearable :key="dict.value" :label="dict.label"
113
-                          :value="dict.value" />
114
-                      </el-select>
115
-                      <el-autocomplete v-model="detail.borrowItem" :fetch-suggestions="querySearchAsync" placeholder="请输入内容"
116
-                        style="width: 100%;" :disabled="taskName != '借款申请'" v-else></el-autocomplete>
117
-                    </td>
118
-                    <td>
119
-                      <el-input v-model="detail.unit" :disabled="taskName != '借款申请'"></el-input>
120
-                    </td>
121
-                    <td>
122
-                      <el-input-number :controls="false" style="width: 100%;" v-model="detail.price"
123
-                        @change="calculateAmount(detail)" :disabled="taskName != '借款申请'"></el-input-number>
124
-                    </td>
125
-                    <td>
126
-                      <el-input-number :controls="false" style="width: 100%;" v-model="detail.quantity"
127
-                        @change="calculateAmount(detail)" :disabled="taskName != '借款申请'"></el-input-number>
128
-                    </td>
129
-                    <td>
130
-                      <el-input v-model="detail.applyAmount" :disabled="taskName != '借款申请'"></el-input>
131
-                    </td>
132
-                    <td v-if="form.borrowUsage == 0 || form.borrowUsage == 1">
133
-                      <el-input v-model="detail.managerAmount" :disabled="taskName != '分管审核' && taskName != '总经理审核'"
134
-                        @blur="calculateManagerAmount(detail)"></el-input>
135
-                    </td>
136
-                    <td>
137
-                      <el-button type="text" style="color: #F56C6C;" icon="el-icon-delete" size="mini"
138
-                        :disabled="taskName != '借款申请'" @click="deleDetailItem(index)">删除</el-button>
65
+                    <td colspan="2" class="label-cell">项目信息</td>
66
+                    <td colspan="10">
67
+                      <el-button type="primary" size="mini" @click="openProject = true"
68
+                        v-if="taskName == '借款申请'">选择项目</el-button>
69
+                      <template v-if="isSelect">
70
+                        <table class="inner-table">
71
+                          <tr>
72
+                            <td class="label-cell">项目编号</td>
73
+                            <td>{{ chooseProject.projectNumber }}</td>
74
+                            <td class="label-cell">项目名称</td>
75
+                            <td>{{ chooseProject.projectName }}</td>
76
+                          </tr>
77
+                          <tr>
78
+                            <td class="label-cell">项目负责人</td>
79
+                            <td>{{ chooseProject.projectLeaderUser ? chooseProject.projectLeaderUser.nickName : '' }}
80
+                            </td>
81
+                            <td class="label-cell">承担部门</td>
82
+                            <td>{{ chooseProject.undertakingDeptName }}</td>
83
+                          </tr>
84
+                          <tr>
85
+                            <td class="label-cell">项目类型</td>
86
+                            <td colspan="3">{{ chooseProject.projectType }}</td>
87
+                          </tr>
88
+                        </table>
89
+                      </template>
90
+                      <el-form-item prop="projectId" class="table-form-item" style="display: none;"></el-form-item>
139 91
                     </td>
140 92
                   </tr>
141
-                </table>
142
-                <el-button class="mt10" icon="el-icon-plus" size="mini" @click="addDetailList()" type="primary" plain
143
-                  :disabled="taskName != '借款申请'">添加明细行</el-button>
144
-              </td>
145
-            </tr>
146
-
147
-            <tr v-if="isSelect" class="budget-row">
148
-              <td colspan="2" class="label-cell">最大借款金额</td>
149
-              <td colspan="2" class="budget-value-cell">
150
-                <div class="budget-amount">
151
-                  <span class="amount-num">{{ siteExpenses.toFixed(2) }}</span>
152
-                  <span class="amount-cn">大写:{{ formatNumberWithWan(siteExpenses) }}</span>
153
-                </div>
154
-                <el-button type="text" size="mini" class="budget-link-btn" @click="openBudget = true"
155
-                  v-hasPermi="['oa:budget:list']">查看预算</el-button>
156
-              </td>
157
-              <td colspan="2" class="label-cell">已申请借款</td>
158
-              <td colspan="2" class="budget-value-cell">
159
-                <div class="budget-amount is-danger">
160
-                  <span class="amount-num">{{ hasBorrow.toFixed(2) }}</span>
161
-                  <span class="amount-cn">大写:{{ formatNumberWithWan(hasBorrow) }}</span>
162
-                </div>
163
-                <el-button type="text" size="mini" class="budget-link-btn" @click="openBorrow = true">查看历史借款</el-button>
164
-              </td>
165
-              <td colspan="2" class="label-cell">可用借款</td>
166
-              <td colspan="2" class="budget-value-cell">
167
-                <div class="budget-amount is-success">
168
-                  <span class="amount-num">{{ (siteExpenses - hasBorrow).toFixed(2) }}</span>
169
-                  <span class="amount-cn">大写:{{ formatNumberWithWan((siteExpenses - hasBorrow)) }}</span>
170
-                </div>
171
-              </td>
172
-            </tr>
173
-
174
-            <tr>
175
-              <td colspan="2" class="label-cell">申请金额</td>
176
-              <td colspan="4">
177
-                <el-form-item prop="applyAmount" class="table-form-item">
178
-                  <el-input v-model="form.applyAmount" placeholder="请输入申请金额" :disabled="taskName != '借款申请'" />
179
-                  <span class="exceed-tip" v-if="exceed && form.borrowUsage == 0">超过预算金额:{{ getMoreAmount('0') }}</span>
180
-                </el-form-item>
181
-              </td>
182
-              <td colspan="2" class="label-cell">核准金额</td>
183
-              <td colspan="4">
184
-                <el-form-item prop="managerAmount" class="table-form-item">
185
-                  <el-input v-model="form.managerAmount" placeholder="请输入核准金额"
186
-                    :disabled="taskName != '分管审核' && taskName != '总经理审核' && taskName != '党工团审核'" />
187
-                  <span class="exceed-tip" v-if="exceed && form.managerAmount && form.borrowUsage == 0">超过预算金额:{{
188
-                    getMoreAmount('1') }}</span>
189
-                </el-form-item>
190
-              </td>
191
-            </tr>
93
+                </template>
94
+              </template>
192 95
 
193
-            <tr>
194
-              <td colspan="2" class="label-cell">申请人说明</td>
195
-              <td colspan="10">
196
-                <el-form-item prop="remark" class="table-form-item">
197
-                  <el-input type="textarea" :rows="4" v-model="form.remark" placeholder="请输入申请人说明"
198
-                    :disabled="taskName != '借款申请'" />
199
-                </el-form-item>
200
-              </td>
201
-            </tr>
96
+              <tr>
97
+                <td colspan="2" class="label-cell">借款明细</td>
98
+                <td colspan="10">
99
+                  <table class="inner-table detail-inner-table">
100
+                    <tr>
101
+                      <td class="label-cell" style="width: 50px;">序号</td>
102
+                      <td class="label-cell" style="min-width: 150px;">开支项目</td>
103
+                      <td class="label-cell">单位</td>
104
+                      <td class="label-cell">单价</td>
105
+                      <td class="label-cell">数量</td>
106
+                      <td class="label-cell">申请金额</td>
107
+                      <td class="label-cell" v-if="form.borrowUsage == 0 || form.borrowUsage == 1">分管领导审核金额</td>
108
+                      <td class="label-cell">操作</td>
109
+                    </tr>
110
+                    <tr v-for="(detail, index) in detailList" :key="index">
111
+                      <td>{{ index + 1 }}</td>
112
+                      <td>
113
+                        <el-select v-model="detail.borrowItem" placeholder="请选择开支项" clearable
114
+                          @change="handleExpenseChange" style="width: 100%;" :disabled="taskName != '借款申请'"
115
+                          v-if="form.borrowUsage == 0">
116
+                          <el-option v-for="dict in dict.type.cmc_borrow_expense" clearable :key="dict.value"
117
+                            :label="dict.label" :value="dict.value" />
118
+                        </el-select>
119
+                        <el-autocomplete v-model="detail.borrowItem" :fetch-suggestions="querySearchAsync"
120
+                          placeholder="请输入内容" style="width: 100%;" :disabled="taskName != '借款申请'"
121
+                          v-else></el-autocomplete>
122
+                      </td>
123
+                      <td>
124
+                        <el-input v-model="detail.unit" :disabled="taskName != '借款申请'"></el-input>
125
+                      </td>
126
+                      <td>
127
+                        <el-input-number :controls="false" style="width: 100%;" v-model="detail.price"
128
+                          @change="calculateAmount(detail)" :disabled="taskName != '借款申请'"></el-input-number>
129
+                      </td>
130
+                      <td>
131
+                        <el-input-number :controls="false" style="width: 100%;" v-model="detail.quantity"
132
+                          @change="calculateAmount(detail)" :disabled="taskName != '借款申请'"></el-input-number>
133
+                      </td>
134
+                      <td>
135
+                        <el-input v-model="detail.applyAmount" :disabled="taskName != '借款申请'"></el-input>
136
+                      </td>
137
+                      <td v-if="form.borrowUsage == 0 || form.borrowUsage == 1">
138
+                        <el-input v-model="detail.managerAmount" :disabled="taskName != '分管审核' && taskName != '总经理审核'"
139
+                          @blur="calculateManagerAmount(detail)"></el-input>
140
+                      </td>
141
+                      <td>
142
+                        <el-button type="text" style="color: #F56C6C;" icon="el-icon-delete" size="mini"
143
+                          :disabled="taskName != '借款申请'" @click="deleDetailItem(index)">删除</el-button>
144
+                      </td>
145
+                    </tr>
146
+                  </table>
147
+                  <el-button class="mt10" icon="el-icon-plus" size="mini" @click="addDetailList()" type="primary" plain
148
+                    :disabled="taskName != '借款申请'">添加明细行</el-button>
149
+                </td>
150
+              </tr>
202 151
 
203
-            <tr>
204
-              <td colspan="2" class="label-cell">附件上传</td>
205
-              <td colspan="10">
206
-                <el-form-item prop="borrowDocument" class="table-form-item">
207
-                  <FileUpload v-if="form.borrowDocument == null || form.borrowDocument == ''" :disabled="taskName != '借款申请'"
208
-                    :limit="1" :filePathName="'借款/申请附件'" :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']"
209
-                    @input="getBorrowPath"></FileUpload>
210
-                  <div v-if="form.borrowDocument">
211
-                    <el-link type="primary" @click="reviewWord(`${baseUrl}${'/profile/upload' + form.borrowDocument}`)">
212
-                      {{ getFileName(form.borrowDocument) }}
213
-                    </el-link>
214
-                    <el-link class="ml20" type="warning" :href="`${baseUrl}${'/profile/upload' + form.borrowDocument}`"
215
-                      :underline="false" target="_blank">
216
-                      <span class="el-icon-download">下载文件</span>
217
-                    </el-link>
218
-                    <FileUpload v-if="taskName == '借款申请'" :limit="1" :filePathName="'借款/申请附件'"
219
-                      :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="getBorrowPath"></FileUpload>
152
+              <tr v-if="isSelect" class="budget-row">
153
+                <td colspan="2" class="label-cell">最大借款金额</td>
154
+                <td colspan="2" class="budget-value-cell">
155
+                  <div class="budget-amount">
156
+                    <span class="amount-num">{{ siteExpenses.toFixed(2) }}</span>
157
+                    <span class="amount-cn">大写:{{ formatNumberWithWan(siteExpenses) }}</span>
158
+                  </div>
159
+                  <el-button type="text" size="mini" class="budget-link-btn" @click="openBudget = true"
160
+                    v-hasPermi="['oa:budget:list']">查看预算</el-button>
161
+                </td>
162
+                <td colspan="2" class="label-cell">已申请借款</td>
163
+                <td colspan="2" class="budget-value-cell">
164
+                  <div class="budget-amount is-danger">
165
+                    <span class="amount-num">{{ hasBorrow.toFixed(2) }}</span>
166
+                    <span class="amount-cn">大写:{{ formatNumberWithWan(hasBorrow) }}</span>
167
+                  </div>
168
+                  <el-button type="text" size="mini" class="budget-link-btn"
169
+                    @click="openBorrow = true">查看历史借款</el-button>
170
+                </td>
171
+                <td colspan="2" class="label-cell">可用借款</td>
172
+                <td colspan="2" class="budget-value-cell">
173
+                  <div class="budget-amount is-success">
174
+                    <span class="amount-num">{{ (siteExpenses - hasBorrow).toFixed(2) }}</span>
175
+                    <span class="amount-cn">大写:{{ formatNumberWithWan((siteExpenses - hasBorrow)) }}</span>
220 176
                   </div>
221
-                </el-form-item>
222
-              </td>
223
-            </tr>
177
+                </td>
178
+              </tr>
224 179
 
225
-            <template v-if="form.borrowUsage == 0 || form.borrowUsage == 1">
226 180
               <tr>
227
-                <td colspan="2" class="label-cell">部门负责人意见</td>
228
-                <td colspan="10">
229
-                  <el-form-item prop="deptComment" class="table-form-item">
230
-                    <el-input type="textarea" v-model="form.deptComment" placeholder="请输入部门负责人意见"
231
-                      :disabled="taskName != '部门审核'" :autosize="{ minRows: 4 }" />
181
+                <td colspan="2" class="label-cell">申请金额</td>
182
+                <td colspan="4">
183
+                  <el-form-item prop="applyAmount" class="table-form-item">
184
+                    <el-input v-model="form.applyAmount" placeholder="请输入申请金额" :disabled="taskName != '借款申请'" />
185
+                    <span class="exceed-tip" v-if="exceed && form.borrowUsage == 0">超过预算金额:{{ getMoreAmount('0')
186
+                      }}</span>
187
+                  </el-form-item>
188
+                </td>
189
+                <td colspan="2" class="label-cell">核准金额</td>
190
+                <td colspan="4">
191
+                  <el-form-item prop="managerAmount" class="table-form-item">
192
+                    <el-input v-model="form.managerAmount" placeholder="请输入核准金额"
193
+                      :disabled="taskName != '分管审核' && taskName != '总经理审核' && taskName != '党工团审核'" />
194
+                    <span class="exceed-tip" v-if="exceed && form.managerAmount && form.borrowUsage == 0">超过预算金额:{{
195
+                      getMoreAmount('1') }}</span>
232 196
                   </el-form-item>
233
-                  <el-row class="sign-line" v-if="showFormItem('部门审核')">
234
-                    <el-col :span="6" :offset="11">
235
-                      签名:<span class="auditor">{{ form.deptUser ? form.deptUser.nickName : deptUser }}</span>
236
-                    </el-col>
237
-                    <el-col :span="6">
238
-                      日期:<span>{{ form.deptTime ? form.deptTime : deptTime }}</span>
239
-                    </el-col>
240
-                  </el-row>
241 197
                 </td>
242 198
               </tr>
199
+
243 200
               <tr>
244
-                <td colspan="2" class="label-cell">分管领导审核</td>
201
+                <td colspan="2" class="label-cell">申请人说明</td>
245 202
                 <td colspan="10">
246
-                  <el-form-item prop="managerComment" class="table-form-item">
247
-                    <el-input type="textarea" v-model="form.managerComment" placeholder="请输入分管领导审核意见"
248
-                      :disabled="taskName != '分管审核'" :autosize="{ minRows: 4 }" />
203
+                  <el-form-item prop="remark" class="table-form-item">
204
+                    <el-input type="textarea" :rows="4" v-model="form.remark" placeholder="请输入申请人说明"
205
+                      :disabled="taskName != '借款申请'" />
249 206
                   </el-form-item>
250
-                  <el-row class="sign-line" v-if="showFormItem('分管审核')">
251
-                    <el-col :span="6" :offset="11">
252
-                      签名:<span class="auditor">{{ form.managerUser ? form.managerUser.nickName : managerUser }}</span>
253
-                    </el-col>
254
-                    <el-col :span="6">
255
-                      日期:<span>{{ form.managerTime ? form.managerTime : managerTime }}</span>
256
-                    </el-col>
257
-                  </el-row>
258 207
                 </td>
259 208
               </tr>
209
+
260 210
               <tr>
261
-                <td colspan="2" class="label-cell">总经理审批</td>
211
+                <td colspan="2" class="label-cell">附件上传</td>
262 212
                 <td colspan="10">
263
-                  <el-form-item prop="zjlComment" class="table-form-item">
264
-                    <el-input type="textarea" v-model="form.zjlComment" placeholder="请输入总经理审批意见"
265
-                      :disabled="taskName != '总经理审核'" :autosize="{ minRows: 4 }" />
213
+                  <el-form-item prop="borrowDocument" class="table-form-item">
214
+                    <FileUpload v-if="form.borrowDocument == null || form.borrowDocument == ''"
215
+                      :disabled="taskName != '借款申请'" :limit="1" :filePathName="'借款/申请附件'"
216
+                      :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="getBorrowPath">
217
+                    </FileUpload>
218
+                    <div v-if="form.borrowDocument">
219
+                      <el-link type="primary"
220
+                        @click="reviewWord(`${baseUrl}${'/profile/upload' + form.borrowDocument}`)">
221
+                        {{ getFileName(form.borrowDocument) }}
222
+                      </el-link>
223
+                      <el-link class="ml20" type="warning"
224
+                        :href="`${baseUrl}${'/profile/upload' + form.borrowDocument}`" :underline="false"
225
+                        target="_blank">
226
+                        <span class="el-icon-download">下载文件</span>
227
+                      </el-link>
228
+                      <FileUpload v-if="taskName == '借款申请'" :limit="1" :filePathName="'借款/申请附件'"
229
+                        :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="getBorrowPath">
230
+                      </FileUpload>
231
+                    </div>
266 232
                   </el-form-item>
267
-                  <el-row class="sign-line" v-if="showFormItem('总经理审核')">
233
+                </td>
234
+              </tr>
235
+
236
+              <template v-if="form.borrowUsage == 0 || form.borrowUsage == 1">
237
+                <tr>
238
+                  <td colspan="2" class="label-cell">部门负责人意见</td>
239
+                  <td colspan="10">
240
+                    <el-form-item prop="deptComment" class="table-form-item">
241
+                      <el-input type="textarea" v-model="form.deptComment" placeholder="请输入部门负责人意见"
242
+                        :disabled="taskName != '部门审核'" :autosize="{ minRows: 4 }" />
243
+                    </el-form-item>
244
+                    <el-row class="sign-line" v-if="showFormItem('部门审核')">
245
+                      <el-col :span="6" :offset="11">
246
+                        签名:<span class="auditor">{{ form.deptUser ? form.deptUser.nickName : deptUser }}</span>
247
+                      </el-col>
248
+                      <el-col :span="6">
249
+                        日期:<span>{{ form.deptTime ? form.deptTime : deptTime }}</span>
250
+                      </el-col>
251
+                    </el-row>
252
+                  </td>
253
+                </tr>
254
+                <tr>
255
+                  <td colspan="2" class="label-cell">分管领导审核</td>
256
+                  <td colspan="10">
257
+                    <el-form-item prop="managerComment" class="table-form-item">
258
+                      <el-input type="textarea" v-model="form.managerComment" placeholder="请输入分管领导审核意见"
259
+                        :disabled="taskName != '分管审核'" :autosize="{ minRows: 4 }" />
260
+                    </el-form-item>
261
+                    <el-row class="sign-line" v-if="showFormItem('分管审核')">
262
+                      <el-col :span="6" :offset="11">
263
+                        签名:<span class="auditor">{{ form.managerUser ? form.managerUser.nickName : managerUser }}</span>
264
+                      </el-col>
265
+                      <el-col :span="6">
266
+                        日期:<span>{{ form.managerTime ? form.managerTime : managerTime }}</span>
267
+                      </el-col>
268
+                    </el-row>
269
+                  </td>
270
+                </tr>
271
+                <tr>
272
+                  <td colspan="2" class="label-cell">总经理审批</td>
273
+                  <td colspan="10">
274
+                    <el-form-item prop="zjlComment" class="table-form-item">
275
+                      <el-input type="textarea" v-model="form.zjlComment" placeholder="请输入总经理审批意见"
276
+                        :disabled="taskName != '总经理审核'" :autosize="{ minRows: 4 }" />
277
+                    </el-form-item>
278
+                    <el-row class="sign-line" v-if="showFormItem('总经理审核')">
279
+                      <el-col :span="6" :offset="11">
280
+                        签名:<span class="auditor">{{ form.zjlUser ? form.zjlUser.nickName : zjlUser }}</span>
281
+                      </el-col>
282
+                      <el-col :span="6">
283
+                        日期:<span>{{ form.zjlTime ? form.zjlTime : zjlTime }}</span>
284
+                      </el-col>
285
+                    </el-row>
286
+                  </td>
287
+                </tr>
288
+                <tr v-if="exceed && !form.cwUser">
289
+                  <td colspan="2" class="label-cell">董事长批准</td>
290
+                  <td colspan="10">
291
+                    <el-form-item prop="dszComment" class="table-form-item">
292
+                      <el-input type="textarea" v-model="form.dszComment" placeholder="请输入董事长批准意见"
293
+                        :disabled="taskName != '董事长批准'" :autosize="{ minRows: 4 }" />
294
+                    </el-form-item>
295
+                    <el-row class="sign-line" v-if="showFormItem('董事长批准')">
296
+                      <el-col :span="6" :offset="11">
297
+                        签名:<span class="auditor">{{ form.dszUser ? form.dszUser.nickName : dszUser }}</span>
298
+                      </el-col>
299
+                      <el-col :span="6">
300
+                        日期:<span>{{ form.dszTime ? form.dszTime : dszTime }}</span>
301
+                      </el-col>
302
+                    </el-row>
303
+                  </td>
304
+                </tr>
305
+              </template>
306
+
307
+              <tr v-if="form.borrowUsage != 0 && form.borrowUsage != 1">
308
+                <td colspan="2" class="label-cell">{{ dgtLabel }}</td>
309
+                <td colspan="10">
310
+                  <el-form-item prop="unionComment" class="table-form-item">
311
+                    <el-input type="textarea" v-model="form.unionComment" placeholder="请输入审核意见"
312
+                      :disabled="taskName != '党工团审核'" />
313
+                  </el-form-item>
314
+                  <el-row class="sign-line" v-if="showFormItem('党工团审核')">
268 315
                     <el-col :span="6" :offset="11">
269
-                      签名:<span class="auditor">{{ form.zjlUser ? form.zjlUser.nickName : zjlUser }}</span>
316
+                      签名:<span class="auditor">{{ form.unionUser ? form.unionUser.nickName : unionUser }}</span>
270 317
                     </el-col>
271 318
                     <el-col :span="6">
272
-                      日期:<span>{{ form.zjlTime ? form.zjlTime : zjlTime }}</span>
319
+                      日期:<span>{{ form.unionTime ? form.unionTime : unionTime }}</span>
273 320
                     </el-col>
274 321
                   </el-row>
275 322
                 </td>
276 323
               </tr>
277
-              <tr v-if="exceed && !form.cwUser">
278
-                <td colspan="2" class="label-cell">董事长批准</td>
324
+
325
+              <tr>
326
+                <td colspan="2" class="label-cell">财务部处理</td>
279 327
                 <td colspan="10">
280
-                  <el-form-item prop="dszComment" class="table-form-item">
281
-                    <el-input type="textarea" v-model="form.dszComment" placeholder="请输入董事长批准意见"
282
-                      :disabled="taskName != '董事长批准'" :autosize="{ minRows: 4 }" />
283
-                  </el-form-item>
284
-                  <el-row class="sign-line" v-if="showFormItem('董事长批准')">
328
+                  <div class="table-form-item">
329
+                    <div class="sub-label">支付凭证</div>
330
+                    <el-form-item prop="lendDocument" class="table-form-item">
331
+                      <FileUpload v-if="taskName == '财务处理'" :disabled="taskName != '财务处理'" :limit="1"
332
+                        :filePathName="'借款/支付凭证'" :isShowTip="false"
333
+                        :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="getLendPath">
334
+                      </FileUpload>
335
+                      <div v-if="form.lendDocument && taskName != '财务处理'">
336
+                        <el-link type="primary"
337
+                          @click="reviewWord(`${baseUrl}${'/profile/upload' + form.lendDocument}`)">
338
+                          {{ getFileName(form.lendDocument) }}
339
+                        </el-link>
340
+                        <el-link class="ml20" type="warning"
341
+                          :href="`${baseUrl}${'/profile/upload' + form.lendDocument}`" :underline="false"
342
+                          target="_blank">
343
+                          <span class="el-icon-download">下载文件</span>
344
+                        </el-link>
345
+                      </div>
346
+                    </el-form-item>
347
+                    <div class="sub-label">支付备注</div>
348
+                    <el-form-item prop="cwComment" class="table-form-item">
349
+                      <el-input type="textarea" v-model="form.cwComment" placeholder="请输入财务部支付备注"
350
+                        :disabled="taskName != '财务处理'" :autosize="{ minRows: 2 }" />
351
+                    </el-form-item>
352
+                  </div>
353
+                  <el-row class="sign-line" v-if="showFormItem('财务处理')">
285 354
                     <el-col :span="6" :offset="11">
286
-                      签名:<span class="auditor">{{ form.dszUser ? form.dszUser.nickName : dszUser }}</span>
355
+                      经办人:<span class="auditor">{{ form.cwUser ? form.cwUser.nickName : cwUser }}</span>
287 356
                     </el-col>
288 357
                     <el-col :span="6">
289
-                      日期:<span>{{ form.dszTime ? form.dszTime : dszTime }}</span>
358
+                      支付日期:
359
+                      <el-form-item prop="lendTime" class="table-form-item inline-item">
360
+                        <el-date-picker style="width: 160px;" v-model="form.lendTime" value-format="yyyy-MM-dd"
361
+                          type="date" placeholder="选择日期" :disabled="taskName != '财务处理'">
362
+                        </el-date-picker>
363
+                      </el-form-item>
290 364
                     </el-col>
291 365
                   </el-row>
292 366
                 </td>
293 367
               </tr>
294
-            </template>
295
-
296
-            <tr v-if="form.borrowUsage != 0 && form.borrowUsage != 1">
297
-              <td colspan="2" class="label-cell">{{ dgtLabel }}</td>
298
-              <td colspan="10">
299
-                <el-form-item prop="unionComment" class="table-form-item">
300
-                  <el-input type="textarea" v-model="form.unionComment" placeholder="请输入审核意见"
301
-                    :disabled="taskName != '党工团审核'" />
302
-                </el-form-item>
303
-                <el-row class="sign-line" v-if="showFormItem('党工团审核')">
304
-                  <el-col :span="6" :offset="11">
305
-                    签名:<span class="auditor">{{ form.unionUser ? form.unionUser.nickName : unionUser }}</span>
306
-                  </el-col>
307
-                  <el-col :span="6">
308
-                    日期:<span>{{ form.unionTime ? form.unionTime : unionTime }}</span>
309
-                  </el-col>
310
-                </el-row>
311
-              </td>
312
-            </tr>
313
-
314
-            <tr>
315
-              <td colspan="2" class="label-cell">财务部处理</td>
316
-              <td colspan="10">
317
-                <div class="table-form-item">
318
-                  <div class="sub-label">支付凭证</div>
319
-                  <el-form-item prop="lendDocument" class="table-form-item">
320
-                    <FileUpload v-if="taskName == '财务处理'" :disabled="taskName != '财务处理'" :limit="1"
321
-                      :filePathName="'借款/支付凭证'" :isShowTip="false"
322
-                      :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="getLendPath">
323
-                    </FileUpload>
324
-                    <div v-if="form.lendDocument && taskName != '财务处理'">
325
-                      <el-link type="primary" @click="reviewWord(`${baseUrl}${'/profile/upload' + form.lendDocument}`)">
326
-                        {{ getFileName(form.lendDocument) }}
327
-                      </el-link>
328
-                      <el-link class="ml20" type="warning" :href="`${baseUrl}${'/profile/upload' + form.lendDocument}`"
329
-                        :underline="false" target="_blank">
330
-                        <span class="el-icon-download">下载文件</span>
331
-                      </el-link>
332
-                    </div>
333
-                  </el-form-item>
334
-                  <div class="sub-label">支付备注</div>
335
-                  <el-form-item prop="cwComment" class="table-form-item">
336
-                    <el-input type="textarea" v-model="form.cwComment" placeholder="请输入财务部支付备注"
337
-                      :disabled="taskName != '财务处理'" :autosize="{ minRows: 2 }" />
338
-                  </el-form-item>
339
-                </div>
340
-                <el-row class="sign-line" v-if="showFormItem('财务处理')">
341
-                  <el-col :span="6" :offset="11">
342
-                    经办人:<span class="auditor">{{ form.cwUser ? form.cwUser.nickName : cwUser }}</span>
343
-                  </el-col>
344
-                  <el-col :span="6">
345
-                    支付日期:
346
-                    <el-form-item prop="lendTime" class="table-form-item inline-item">
347
-                      <el-date-picker style="width: 160px;" v-model="form.lendTime" value-format="yyyy-MM-dd" type="date"
348
-                        placeholder="选择日期" :disabled="taskName != '财务处理'">
349
-                      </el-date-picker>
350
-                    </el-form-item>
351
-                  </el-col>
352
-                </el-row>
353
-              </td>
354
-            </tr>
355
-          </table>
368
+            </table>
356 369
           </div>
357 370
         </el-form>
358 371
         <div class="form-footer" v-if="taskName != ''">
@@ -368,7 +381,7 @@
368 381
             <flow :flowData="flowData" />
369 382
           </div>
370 383
         </el-card>
371
-      </el-col> 
384
+      </el-col>
372 385
     </el-row>
373 386
     <el-dialog title="选择项目" :visible.sync="openProject" width="70%" append-to-body>
374 387
       <project-choose @chooseProject="confirmProject"></project-choose>
@@ -700,6 +713,9 @@ export default {
700 713
           }
701 714
         });
702 715
         this.hasBorrow = hasBorrow
716
+      } else {
717
+        this.hasBorrow = 0;
718
+        this.historyBorrowList = [];
703 719
       }
704 720
       if (this.form.borrowUsage == '0') {
705 721
         if ((this.siteExpenses - this.hasBorrow - this.form.applyAmount) < 0) {
@@ -1377,6 +1393,7 @@ $accent: #409eff;
1377 1393
 }
1378 1394
 
1379 1395
 .budget-row {
1396
+
1380 1397
   td.budget-value-cell,
1381 1398
   td:not(.label-cell) {
1382 1399
     // background-color: #f5f7fa;

+ 346
- 83
oa-ui/src/views/statistics/components/topHead.vue Просмотреть файл

@@ -6,10 +6,14 @@
6 6
         <div class="data-left">
7 7
           <div class="data-title">{{ thisYear }}年项目总数</div>
8 8
           <div class="number">{{ projectNum.toLocaleString('en-US') }}</div>
9
-          <div>
10
-            <span class="text-1">较去年</span>
9
+          <div class="compare-row">
10
+            <span class="text-1">同比</span>
11 11
             <span class="text-2" :class="{ upColor: isProjectUp, dowColor: !isProjectUp }">{{ subYear }}</span>
12 12
             <img :src="isProjectUp ? upImg : downImg" alt="">
13
+            <span class="text-1 compare-gap">环比</span>
14
+            <span class="text-2" :class="{ upColor: isProjectMonthUp, dowColor: !isProjectMonthUp }">{{ subMonth
15
+            }}</span>
16
+            <img :src="isProjectMonthUp ? upImg : downImg" alt="">
13 17
           </div>
14 18
         </div>
15 19
         <div class="chart-box">
@@ -20,11 +24,15 @@
20 24
         <div class="data-left">
21 25
           <div class="data-title">{{ thisYear }}年承接合同数</div>
22 26
           <div class="number">{{ contractNum.toLocaleString('en-US') }}</div>
23
-          <div>
24
-            <span class="text-1">较去年</span>
27
+          <div class="compare-row">
28
+            <span class="text-1">同比</span>
25 29
             <span class="text-2" :class="{ upColor: isContractUp, dowColor: !isContractUp }">{{ contractSubYear
26 30
               }}</span>
27 31
             <img :src="isContractUp ? upImg : downImg" alt="">
32
+            <span class="text-1 compare-gap">环比</span>
33
+            <span class="text-2" :class="{ upColor: isContractMonthUp, dowColor: !isContractMonthUp }">{{
34
+              contractSubMonth }}</span>
35
+            <img :src="isContractMonthUp ? upImg : downImg" alt="">
28 36
           </div>
29 37
         </div>
30 38
         <div class="chart-box">
@@ -35,10 +43,13 @@
35 43
         <div class="data-left">
36 44
           <div class="data-title">{{ thisYear }}借款次数</div>
37 45
           <div class="number">{{ borrowNum.toLocaleString('en-US') }}</div>
38
-          <div>
39
-            <span class="text-1">较去年</span>
46
+          <div class="compare-row">
47
+            <span class="text-1">同比</span>
40 48
             <span class="text-2" :class="{ upColor: isBorrowUp, dowColor: !isBorrowUp }">{{ borrowSubYear }}</span>
41 49
             <img :src="isBorrowUp ? upImg : downImg" alt="">
50
+            <span class="text-1 compare-gap">环比</span>
51
+            <span class="text-2" :class="{ upColor: isBorrowMonthUp, dowColor: !isBorrowMonthUp }">{{ borrowSubMonth }}</span>
52
+            <img :src="isBorrowMonthUp ? upImg : downImg" alt="">
42 53
           </div>
43 54
         </div>
44 55
         <div class="chart-box">
@@ -46,7 +57,7 @@
46 57
         </div>
47 58
       </div>
48 59
 
49
-      <div class="five item-box" @click="$emit('handleClick', 'settle')">
60
+      <!-- <div class="five item-box" @click="$emit('handleClick', 'settle')">
50 61
         <div class="data-left">
51 62
           <div class="data-title">{{ thisYear }}结算次数</div>
52 63
           <div class="number">{{ settleNum.toLocaleString('en-US') }}</div>
@@ -59,15 +70,18 @@
59 70
         <div class="chart-box">
60 71
           <div id="thisSettle"></div>
61 72
         </div>
62
-      </div>
73
+      </div> -->
63 74
       <div class="three item-box" @click="$emit('handleClick', 'device')">
64 75
         <div class="data-left">
65 76
           <div class="data-title">{{ thisYear }}年设备申领</div>
66 77
           <div class="number">{{ deviceNum.toLocaleString('en-US') }}</div>
67
-          <div>
68
-            <span class="text-1">较去年</span>
78
+          <div class="compare-row">
79
+            <span class="text-1">同比</span>
69 80
             <span class="text-2" :class="{ upColor: isDeviceUp, dowColor: !isDeviceUp }">{{ deviceSubYear }}</span>
70 81
             <img :src="isDeviceUp ? upImg : downImg" alt="">
82
+            <span class="text-1 compare-gap">环比</span>
83
+            <span class="text-2" :class="{ upColor: isDeviceMonthUp, dowColor: !isDeviceMonthUp }">{{ deviceSubMonth }}</span>
84
+            <img :src="isDeviceMonthUp ? upImg : downImg" alt="">
71 85
           </div>
72 86
         </div>
73 87
         <div class="chart-box">
@@ -83,6 +97,11 @@ import upSrc from '@/assets/icons/up.png'
83 97
 import downSrc from '@/assets/icons/down.png'
84 98
 import * as echarts from 'echarts'
85 99
 import { echartsInit } from '@/utils/echarts'
100
+import { listProject } from '@/api/oa/project/project'
101
+import { listContract } from '@/api/oa/contract/contract'
102
+import { listBorrow } from '@/api/oa/borrow/borrow'
103
+import { listDeviceApproval } from '@/api/oa/device/deviceApproval'
104
+
86 105
 let thisYearChart, contractYearChart, deviceYearChart, borrowYearChart, settleYearChart
87 106
 export default {
88 107
   props: {
@@ -117,9 +136,13 @@ export default {
117 136
       upImg: upSrc,
118 137
       downImg: downSrc,
119 138
       isProjectUp: false,
139
+      isProjectMonthUp: false,
120 140
       isContractUp: false,
141
+      isContractMonthUp: false,
121 142
       isDeviceUp: false,
143
+      isDeviceMonthUp: false,
122 144
       isBorrowUp: false,
145
+      isBorrowMonthUp: false,
123 146
       isSettleUp: false,
124 147
       thisYear: new Date().getFullYear(),
125 148
       year: {},
@@ -142,27 +165,43 @@ export default {
142 165
       settleTypeAmount: {},
143 166
       settleYear: {},
144 167
       subYear: 0,
168
+      subMonth: 0,
145 169
       contractSubYear: 0,
170
+      contractSubMonth: 0,
146 171
       deviceSubYear: 0,
172
+      deviceSubMonth: 0,
147 173
       borrowSubYear: 0,
174
+      borrowSubMonth: 0,
148 175
       settleSubYear: 0,
176
+      projectMonthLabels: [],
177
+      projectMonthThisYear: [],
178
+      projectMonthLastYear: [],
179
+      contractMonthLabels: [],
180
+      contractMonthThisYear: [],
181
+      contractMonthLastYear: [],
182
+      borrowMonthLabels: [],
183
+      borrowMonthThisYear: [],
184
+      borrowMonthLastYear: [],
185
+      deviceMonthLabels: [],
186
+      deviceMonthThisYear: [],
187
+      deviceMonthLastYear: [],
149 188
       loading: true
150 189
     }
151 190
   },
152 191
   watch: {
153
-    year() {
192
+    projectMonthThisYear() {
154 193
       this.initChartOne();
155 194
     },
156
-    contractYear() {
195
+    contractMonthThisYear() {
157 196
       this.initChartTwo();
158 197
     },
159
-    deviceYear() {
160
-      this.initChartThree();
161
-    },
162
-    borrowYear() {
198
+    borrowMonthThisYear() {
163 199
       this.initChartFour();
164 200
     },
165
-    settleYear(){
201
+    deviceMonthThisYear() {
202
+      this.initChartThree();
203
+    },
204
+    settleYear() {
166 205
       this.initChartFive();
167 206
     },
168 207
     pDatas: {
@@ -218,32 +257,34 @@ export default {
218 257
   methods: {
219 258
     async initDatas() {
220 259
       this.loading = true
260
+      await Promise.all([
261
+        this.loadProjectStats(),
262
+        this.loadContractStats(),
263
+        this.loadBorrowStats(),
264
+        this.loadDeviceStats()
265
+      ])
221 266
       if (Object.keys(this.pDatas).length !== 0) {
222 267
         this.year = this.pDatas.year[0];
223 268
         this.type = this.pDatas.type[0];
224 269
         this.source = this.pDatas.source[0];
225 270
         this.dept = this.pDatas.dept[0];
226
-        this.getProjectYearSub(this.year);
227 271
       }
228 272
       if (Object.keys(this.cDatas).length !== 0) {
229 273
         this.contractAmount = this.cDatas.yearAmount[0];
230 274
         this.contractCwAmount = this.cDatas.sourceAmount[0];
231 275
         this.contractSource = this.cDatas.sourceCount[0];
232 276
         this.contractYear = this.cDatas.yearCount[0];
233
-        this.getContractYearSub(this.contractYear);
234 277
       }
235 278
       if (Object.keys(this.dDatas).length !== 0) {
236 279
         this.deviceApproval = this.dDatas.approval[0];
237 280
         this.deviceStatus = this.dDatas.status[0];
238 281
         this.deviceYear = this.dDatas.year[0];
239
-        this.getDeviceYearSub(this.deviceYear);
240 282
       }
241 283
       if (Object.keys(this.bDatas).length !== 0) {
242 284
         this.borrowAmount = this.bDatas.amount[0];
243 285
         this.borrowUsage = this.bDatas.usage[0];
244 286
         this.borrowUsageAmount = this.bDatas.usageAmount[0];
245 287
         this.borrowYear = this.bDatas.year[0];
246
-        this.getBorrowYearSub(this.borrowYear);
247 288
       }
248 289
       if (Object.keys(this.sDatas).length !== 0) {
249 290
         this.settleAmount = this.sDatas.amount[0];
@@ -255,6 +296,227 @@ export default {
255 296
 
256 297
       this.loading = false
257 298
     },
299
+    getMonthRange(year, month, capToToday = false) {
300
+      const monthStr = String(month).padStart(2, '0')
301
+      const begin = `${year}-${monthStr}-01`
302
+      const lastDay = new Date(year, month, 0).getDate()
303
+      let end = `${year}-${monthStr}-${String(lastDay).padStart(2, '0')}`
304
+      if (capToToday) {
305
+        const now = new Date()
306
+        if (year === now.getFullYear() && month === now.getMonth() + 1) {
307
+          end = this.parseTime(now, '{y}-{m}-{d}')
308
+        }
309
+      }
310
+      return [begin, end]
311
+    },
312
+    async fetchProjectCount(begin, end) {
313
+      const res = await listProject(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
314
+      return res.total || 0
315
+    },
316
+    async loadProjectStats() {
317
+      const now = new Date()
318
+      const year = now.getFullYear()
319
+      const today = this.parseTime(now, '{y}-{m}-{d}')
320
+      const thisYearBegin = `${year}-01-01`
321
+      const lastYearBegin = `${year - 1}-01-01`
322
+      const lastYearDate = new Date(now)
323
+      lastYearDate.setFullYear(year - 1)
324
+      const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
325
+      const currentMonth = now.getMonth() + 1
326
+      const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
327
+      const lastMonthYear = lastMonthDate.getFullYear()
328
+      const lastMonth = lastMonthDate.getMonth() + 1
329
+      const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
330
+      const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
331
+
332
+      const monthTasks = []
333
+      const monthLabels = []
334
+      for (let m = 1; m <= currentMonth; m++) {
335
+        monthLabels.push(`${m}月`)
336
+        const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
337
+        const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
338
+        monthTasks.push(this.fetchProjectCount(begin, end))
339
+        monthTasks.push(this.fetchProjectCount(lastBegin, lastEnd))
340
+      }
341
+
342
+      const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
343
+        this.fetchProjectCount(thisYearBegin, today),
344
+        this.fetchProjectCount(lastYearBegin, lastYearToday),
345
+        this.fetchProjectCount(thisMonthBegin, thisMonthEnd),
346
+        this.fetchProjectCount(lastMonthBegin, lastMonthEnd),
347
+        ...monthTasks
348
+      ])
349
+
350
+      this.projectNum = thisYearCount
351
+      this.subYear = Math.abs(thisYearCount - lastYearCount)
352
+      this.isProjectUp = thisYearCount >= lastYearCount
353
+      this.subMonth = Math.abs(thisMonthCount - lastMonthCount)
354
+      this.isProjectMonthUp = thisMonthCount >= lastMonthCount
355
+
356
+      this.projectMonthLabels = monthLabels
357
+      this.projectMonthThisYear = []
358
+      this.projectMonthLastYear = []
359
+      for (let i = 0; i < monthCounts.length; i += 2) {
360
+        this.projectMonthThisYear.push(monthCounts[i])
361
+        this.projectMonthLastYear.push(monthCounts[i + 1])
362
+      }
363
+    },
364
+    async fetchContractCount(begin, end) {
365
+      const res = await listContract(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
366
+      return res.total || 0
367
+    },
368
+    async loadContractStats() {
369
+      const now = new Date()
370
+      const year = now.getFullYear()
371
+      const today = this.parseTime(now, '{y}-{m}-{d}')
372
+      const thisYearBegin = `${year}-01-01`
373
+      const lastYearBegin = `${year - 1}-01-01`
374
+      const lastYearDate = new Date(now)
375
+      lastYearDate.setFullYear(year - 1)
376
+      const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
377
+      const currentMonth = now.getMonth() + 1
378
+      const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
379
+      const lastMonthYear = lastMonthDate.getFullYear()
380
+      const lastMonth = lastMonthDate.getMonth() + 1
381
+      const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
382
+      const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
383
+
384
+      const monthTasks = []
385
+      const monthLabels = []
386
+      for (let m = 1; m <= currentMonth; m++) {
387
+        monthLabels.push(`${m}月`)
388
+        const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
389
+        const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
390
+        monthTasks.push(this.fetchContractCount(begin, end))
391
+        monthTasks.push(this.fetchContractCount(lastBegin, lastEnd))
392
+      }
393
+
394
+      const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
395
+        this.fetchContractCount(thisYearBegin, today),
396
+        this.fetchContractCount(lastYearBegin, lastYearToday),
397
+        this.fetchContractCount(thisMonthBegin, thisMonthEnd),
398
+        this.fetchContractCount(lastMonthBegin, lastMonthEnd),
399
+        ...monthTasks
400
+      ])
401
+
402
+      this.contractNum = thisYearCount
403
+      this.contractSubYear = Math.abs(thisYearCount - lastYearCount)
404
+      this.isContractUp = thisYearCount >= lastYearCount
405
+      this.contractSubMonth = Math.abs(thisMonthCount - lastMonthCount)
406
+      this.isContractMonthUp = thisMonthCount >= lastMonthCount
407
+
408
+      this.contractMonthLabels = monthLabels
409
+      this.contractMonthThisYear = []
410
+      this.contractMonthLastYear = []
411
+      for (let i = 0; i < monthCounts.length; i += 2) {
412
+        this.contractMonthThisYear.push(monthCounts[i])
413
+        this.contractMonthLastYear.push(monthCounts[i + 1])
414
+      }
415
+    },
416
+    async fetchBorrowCount(begin, end) {
417
+      const res = await listBorrow(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
418
+      return res.total || 0
419
+    },
420
+    async loadBorrowStats() {
421
+      const now = new Date()
422
+      const year = now.getFullYear()
423
+      const today = this.parseTime(now, '{y}-{m}-{d}')
424
+      const thisYearBegin = `${year}-01-01`
425
+      const lastYearBegin = `${year - 1}-01-01`
426
+      const lastYearDate = new Date(now)
427
+      lastYearDate.setFullYear(year - 1)
428
+      const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
429
+      const currentMonth = now.getMonth() + 1
430
+      const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
431
+      const lastMonthYear = lastMonthDate.getFullYear()
432
+      const lastMonth = lastMonthDate.getMonth() + 1
433
+      const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
434
+      const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
435
+
436
+      const monthTasks = []
437
+      const monthLabels = []
438
+      for (let m = 1; m <= currentMonth; m++) {
439
+        monthLabels.push(`${m}月`)
440
+        const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
441
+        const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
442
+        monthTasks.push(this.fetchBorrowCount(begin, end))
443
+        monthTasks.push(this.fetchBorrowCount(lastBegin, lastEnd))
444
+      }
445
+
446
+      const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
447
+        this.fetchBorrowCount(thisYearBegin, today),
448
+        this.fetchBorrowCount(lastYearBegin, lastYearToday),
449
+        this.fetchBorrowCount(thisMonthBegin, thisMonthEnd),
450
+        this.fetchBorrowCount(lastMonthBegin, lastMonthEnd),
451
+        ...monthTasks
452
+      ])
453
+
454
+      this.borrowNum = thisYearCount
455
+      this.borrowSubYear = Math.abs(thisYearCount - lastYearCount)
456
+      this.isBorrowUp = thisYearCount >= lastYearCount
457
+      this.borrowSubMonth = Math.abs(thisMonthCount - lastMonthCount)
458
+      this.isBorrowMonthUp = thisMonthCount >= lastMonthCount
459
+
460
+      this.borrowMonthLabels = monthLabels
461
+      this.borrowMonthThisYear = []
462
+      this.borrowMonthLastYear = []
463
+      for (let i = 0; i < monthCounts.length; i += 2) {
464
+        this.borrowMonthThisYear.push(monthCounts[i])
465
+        this.borrowMonthLastYear.push(monthCounts[i + 1])
466
+      }
467
+    },
468
+    async fetchDeviceCount(begin, end) {
469
+      const res = await listDeviceApproval(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
470
+      return res.total || 0
471
+    },
472
+    async loadDeviceStats() {
473
+      const now = new Date()
474
+      const year = now.getFullYear()
475
+      const today = this.parseTime(now, '{y}-{m}-{d}')
476
+      const thisYearBegin = `${year}-01-01`
477
+      const lastYearBegin = `${year - 1}-01-01`
478
+      const lastYearDate = new Date(now)
479
+      lastYearDate.setFullYear(year - 1)
480
+      const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
481
+      const currentMonth = now.getMonth() + 1
482
+      const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
483
+      const lastMonthYear = lastMonthDate.getFullYear()
484
+      const lastMonth = lastMonthDate.getMonth() + 1
485
+      const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
486
+      const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
487
+
488
+      const monthTasks = []
489
+      const monthLabels = []
490
+      for (let m = 1; m <= currentMonth; m++) {
491
+        monthLabels.push(`${m}月`)
492
+        const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
493
+        const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
494
+        monthTasks.push(this.fetchDeviceCount(begin, end))
495
+        monthTasks.push(this.fetchDeviceCount(lastBegin, lastEnd))
496
+      }
497
+
498
+      const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
499
+        this.fetchDeviceCount(thisYearBegin, today),
500
+        this.fetchDeviceCount(lastYearBegin, lastYearToday),
501
+        this.fetchDeviceCount(thisMonthBegin, thisMonthEnd),
502
+        this.fetchDeviceCount(lastMonthBegin, lastMonthEnd),
503
+        ...monthTasks
504
+      ])
505
+
506
+      this.deviceNum = thisYearCount
507
+      this.deviceSubYear = Math.abs(thisYearCount - lastYearCount)
508
+      this.isDeviceUp = thisYearCount >= lastYearCount
509
+      this.deviceSubMonth = Math.abs(thisMonthCount - lastMonthCount)
510
+      this.isDeviceMonthUp = thisMonthCount >= lastMonthCount
511
+
512
+      this.deviceMonthLabels = monthLabels
513
+      this.deviceMonthThisYear = []
514
+      this.deviceMonthLastYear = []
515
+      for (let i = 0; i < monthCounts.length; i += 2) {
516
+        this.deviceMonthThisYear.push(monthCounts[i])
517
+        this.deviceMonthLastYear.push(monthCounts[i + 1])
518
+      }
519
+    },
258 520
     initChartOne() {
259 521
       let option = {
260 522
         grid: {
@@ -275,7 +537,7 @@ export default {
275 537
         },
276 538
         xAxis: {
277 539
           type: 'category',
278
-          data: Object.keys(this.year).slice(-6),
540
+          data: this.projectMonthLabels.slice(-6),
279 541
           show: false
280 542
         },
281 543
         yAxis: {
@@ -285,10 +547,21 @@ export default {
285 547
         },
286 548
         series: [
287 549
           {
550
+            name: '今年',
551
+            min: 0,
552
+            data: this.projectMonthThisYear.slice(-6),
553
+            type: 'line',
554
+            smooth: true,
555
+            itemStyle: { color: '#3498DB' }
556
+          },
557
+          {
558
+            name: '去年同期',
288 559
             min: 0,
289
-            data: Object.values(this.year).slice(-6),
560
+            data: this.projectMonthLastYear.slice(-6),
290 561
             type: 'line',
291 562
             smooth: true,
563
+            itemStyle: { color: '#A0CFFF' },
564
+            lineStyle: { type: 'dashed' }
292 565
           }
293 566
         ]
294 567
       };
@@ -314,7 +587,7 @@ export default {
314 587
         },
315 588
         xAxis: {
316 589
           type: 'category',
317
-          data: Object.keys(this.contractYear).slice(-6),
590
+          data: this.contractMonthLabels.slice(-6),
318 591
           show: false
319 592
         },
320 593
         yAxis: {
@@ -324,13 +597,21 @@ export default {
324 597
         },
325 598
         series: [
326 599
           {
600
+            name: '今年',
327 601
             min: 0,
328
-            data: Object.values(this.contractYear).slice(-6),
602
+            data: this.contractMonthThisYear.slice(-6),
329 603
             type: 'line',
330 604
             smooth: true,
331
-            itemStyle: {
332
-              color: '#00B42A'
333
-            }
605
+            itemStyle: { color: '#00B42A' }
606
+          },
607
+          {
608
+            name: '去年同期',
609
+            min: 0,
610
+            data: this.contractMonthLastYear.slice(-6),
611
+            type: 'line',
612
+            smooth: true,
613
+            itemStyle: { color: '#95DE64' },
614
+            lineStyle: { type: 'dashed' }
334 615
           }
335 616
         ]
336 617
       };
@@ -356,7 +637,7 @@ export default {
356 637
         },
357 638
         xAxis: {
358 639
           type: 'category',
359
-          data: Object.keys(this.deviceYear).slice(-6),
640
+          data: this.deviceMonthLabels.slice(-6),
360 641
           show: false
361 642
         },
362 643
         yAxis: {
@@ -366,13 +647,21 @@ export default {
366 647
         },
367 648
         series: [
368 649
           {
650
+            name: '今年',
369 651
             min: 0,
370
-            data: Object.values(this.deviceYear).slice(-6),
652
+            data: this.deviceMonthThisYear.slice(-6),
371 653
             type: 'line',
372 654
             smooth: true,
373
-            itemStyle: {
374
-              color: '#3498DB'
375
-            }
655
+            itemStyle: { color: '#3498DB' }
656
+          },
657
+          {
658
+            name: '去年同期',
659
+            min: 0,
660
+            data: this.deviceMonthLastYear.slice(-6),
661
+            type: 'line',
662
+            smooth: true,
663
+            itemStyle: { color: '#A0CFFF' },
664
+            lineStyle: { type: 'dashed' }
376 665
           }
377 666
         ]
378 667
       };
@@ -398,7 +687,7 @@ export default {
398 687
         },
399 688
         xAxis: {
400 689
           type: 'category',
401
-          data: Object.keys(this.borrowYear).slice(-6),
690
+          data: this.borrowMonthLabels.slice(-6),
402 691
           show: false
403 692
         },
404 693
         yAxis: {
@@ -408,13 +697,21 @@ export default {
408 697
         },
409 698
         series: [
410 699
           {
700
+            name: '今年',
411 701
             min: 0,
412
-            data: Object.values(this.borrowYear).slice(-6),
702
+            data: this.borrowMonthThisYear.slice(-6),
413 703
             type: 'line',
414 704
             smooth: true,
415
-            itemStyle: {
416
-              color: '#7B68EE'
417
-            }
705
+            itemStyle: { color: '#7B68EE' }
706
+          },
707
+          {
708
+            name: '去年同期',
709
+            min: 0,
710
+            data: this.borrowMonthLastYear.slice(-6),
711
+            type: 'line',
712
+            smooth: true,
713
+            itemStyle: { color: '#C4B5FD' },
714
+            lineStyle: { type: 'dashed' }
418 715
           }
419 716
         ]
420 717
       };
@@ -462,50 +759,6 @@ export default {
462 759
       };
463 760
       echartsInit(settleYearChart, 'thisSettle', option);
464 761
     },
465
-    getProjectYearSub(year) {
466
-      let arr = Object.values(year).slice(-2);
467
-      this.subYear = Number(arr[1]) - Number(arr[0]);
468
-      this.projectNum = Number(arr[1])
469
-      if (this.subYear < 0) {
470
-        this.subYear = - this.subYear;
471
-        this.isProjectUp = false
472
-      } else {
473
-        this.isProjectUp = true
474
-      }
475
-    },
476
-    getContractYearSub(year) {
477
-      let arr = Object.values(year).slice(-2);
478
-      this.contractSubYear = Number(arr[1]) - Number(arr[0]);
479
-      this.contractNum = Number(arr[1])
480
-      if (this.contractSubYear < 0) {
481
-        this.contractSubYear = - this.contractSubYear;
482
-        this.isContractUp = false
483
-      } else {
484
-        this.isContractUp = true
485
-      }
486
-    },
487
-    getDeviceYearSub(year) {
488
-      let arr = Object.values(year).slice(-2);
489
-      this.deviceSubYear = Number(arr[1]) - Number(arr[0]);
490
-      this.deviceNum = Number(arr[1])
491
-      if (this.deviceSubYear < 0) {
492
-        this.deviceSubYear = - this.deviceSubYear;
493
-        this.isDeviceUp = false
494
-      } else {
495
-        this.isDeviceUp = true
496
-      }
497
-    },
498
-    getBorrowYearSub(year) {
499
-      let arr = Object.values(year).slice(-2);
500
-      this.borrowSubYear = Number(arr[1]) - Number(arr[0]);
501
-      this.borrowNum = Number(arr[1])
502
-      if (this.borrowSubYear < 0) {
503
-        this.borrowSubYear = - this.borrowSubYear;
504
-        this.isBorrowUp = false
505
-      } else {
506
-        this.isBorrowUp = true
507
-      }
508
-    },
509 762
     getSettleYearSub(year) {
510 763
       let arr = Object.values(year).slice(-2);
511 764
       this.settleSubYear = Number(arr[1]) - Number(arr[0]);
@@ -552,10 +805,20 @@ export default {
552 805
     .data-title {
553 806
       font-family: 'puhuiti45';
554 807
       font-weight: 500;
555
-      margin-bottom: 24px;
808
+      margin-bottom: 16px;
556 809
       font-size: 16px;
557 810
     }
558 811
 
812
+    .compare-row {
813
+      display: flex;
814
+      align-items: center;
815
+      flex-wrap: wrap;
816
+    }
817
+
818
+    .compare-gap {
819
+      margin-left: 8px;
820
+    }
821
+
559 822
     .number {
560 823
       font-size: 24px;
561 824
       font-family: 'puhuiti45';

Загрузка…
Отмена
Сохранить