Commit 0e2463be97060bd87a20329e0c5942de85e52f7c
1 parent
743c1a59
系统修改记录
Showing
15 changed files
with
740 additions
and
181 deletions
package.json
src/api/info.js
| ... | ... | @@ -16,6 +16,13 @@ export async function getInfoList(data) { |
| 16 | 16 | params: data |
| 17 | 17 | }); |
| 18 | 18 | } |
| 19 | +export async function getUpdataRecord(data) { | |
| 20 | + return await request({ | |
| 21 | + url: '/Extend/basesysteminfolog/SearchSystemList', | |
| 22 | + method: 'get', | |
| 23 | + params: data | |
| 24 | + }); | |
| 25 | +} | |
| 19 | 26 | export async function updataSystem(data) { |
| 20 | 27 | let id = data.id; |
| 21 | 28 | return await request({ | ... | ... |
src/assets/mockdata/demodata.json
| ... | ... | @@ -32,5 +32,22 @@ |
| 32 | 32 | {"title": "清单管理"}, |
| 33 | 33 | {"title": "查询上报"}, |
| 34 | 34 | {"title": "数字大屏"} |
| 35 | - ] | |
| 35 | + ], | |
| 36 | + "infoKeyName": { | |
| 37 | + "companyId": "主体企业", | |
| 38 | + "systemType": "系统类型", | |
| 39 | + "systemName": "系统名称", | |
| 40 | + "systemClass": "系统分类", | |
| 41 | + "systemRecordNumber": "备案号", | |
| 42 | + "recordLicense": "备案许可证", | |
| 43 | + "platform": "归属平坦", | |
| 44 | + "domain": "域名", | |
| 45 | + "systemDownloadVolume": "下载量", | |
| 46 | + "version": "版本", | |
| 47 | + "principalName": "负责人姓名", | |
| 48 | + "principalPhone": "负责人电话", | |
| 49 | + "officeAddress": "办公地址", | |
| 50 | + "systemIcon": "系统图标", | |
| 51 | + "areaId": "所属区县" | |
| 52 | + } | |
| 36 | 53 | } |
| 37 | 54 | \ No newline at end of file | ... | ... |
src/components/InfoEditRecord/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="infoForm"> | |
| 3 | + <div class="userSelect-input" @click="openDialog"> | |
| 4 | + <slot></slot> | |
| 5 | + </div> | |
| 6 | + <el-dialog | |
| 7 | + title="修改信息" | |
| 8 | + :close-on-click-modal="false" | |
| 9 | + :visible.sync="visible" | |
| 10 | + lock-scroll | |
| 11 | + append-to-body | |
| 12 | + width="80%" | |
| 13 | + top="10vh" | |
| 14 | + :modal-append-to-body="false" | |
| 15 | + class="dialog-box" | |
| 16 | + destroy-on-close | |
| 17 | + v-loading="infoForm_loading" | |
| 18 | + > | |
| 19 | + <el-row :gutter="20"> | |
| 20 | + <el-col :span="12"> | |
| 21 | + <el-form | |
| 22 | + :model="infoForm" | |
| 23 | + :rules="infoRules" | |
| 24 | + ref="infoForm" | |
| 25 | + size="small" | |
| 26 | + label-width="100px" | |
| 27 | + :disabled="true" | |
| 28 | + > | |
| 29 | + <el-row :gutter="20"> | |
| 30 | + <el-col :span="24"> | |
| 31 | + <el-col :span="12"> | |
| 32 | + <el-form-item label="主体企业" prop="companyId"> | |
| 33 | + <el-select | |
| 34 | + v-model="infoForm.companyId" | |
| 35 | + placeholder="请选择主体企业" | |
| 36 | + clearable | |
| 37 | + v-loadMore="nextCompanyList" | |
| 38 | + style="width: 100%" | |
| 39 | + @change="companyChange" | |
| 40 | + > | |
| 41 | + <el-option | |
| 42 | + v-for="item in companyOptions" | |
| 43 | + :key="item.id" | |
| 44 | + :label="item.companyName" | |
| 45 | + :value="item.id" | |
| 46 | + > | |
| 47 | + </el-option> | |
| 48 | + </el-select> | |
| 49 | + </el-form-item> | |
| 50 | + </el-col> | |
| 51 | + </el-col> | |
| 52 | + <el-col :span="24" v-if="isShowCompanyInfo"> | |
| 53 | + <div class="company-info"> | |
| 54 | + <div class="company-info-items"> | |
| 55 | + <div :span="12"> | |
| 56 | + 企业归属:{{ companyInfo.areaName || "--" }} | |
| 57 | + </div> | |
| 58 | + <div :span="12"> | |
| 59 | + 联系人:{{ companyInfo.contactUser || "--" }} | |
| 60 | + </div> | |
| 61 | + <div :span="12"> | |
| 62 | + 公司地址:{{ companyInfo.address || "--" }} | |
| 63 | + </div> | |
| 64 | + </div> | |
| 65 | + <div class="company-info-items"> | |
| 66 | + <div :span="12"> | |
| 67 | + 社会信用代码:{{ companyInfo.socialCreditAgency || "--" }} | |
| 68 | + </div> | |
| 69 | + <div :span="12"> | |
| 70 | + 联系电话:{{ companyInfo.contactPhone || "--" }} | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | + </div> | |
| 74 | + </el-col> | |
| 75 | + <el-col :span="24"> | |
| 76 | + <el-form-item label="系统类型" prop="systemType"> | |
| 77 | + <el-radio-group v-model="infoForm.systemType"> | |
| 78 | + <el-radio | |
| 79 | + v-for="v in systemTypeOptions" | |
| 80 | + :key="v.Id" | |
| 81 | + :label="v.Id" | |
| 82 | + @change="systemTypeChange" | |
| 83 | + >{{ v.FullName }}</el-radio | |
| 84 | + > | |
| 85 | + </el-radio-group> | |
| 86 | + </el-form-item> | |
| 87 | + </el-col> | |
| 88 | + <el-col :span="12"> | |
| 89 | + <el-form-item label="系统名称" prop="systemName"> | |
| 90 | + <el-input | |
| 91 | + v-model="infoForm.systemName" | |
| 92 | + placeholder="请输入系统名称" | |
| 93 | + maxlength="50" | |
| 94 | + ></el-input> | |
| 95 | + </el-form-item> | |
| 96 | + </el-col> | |
| 97 | + <el-col :span="12"> | |
| 98 | + <el-form-item label="系统分类" prop="systemClass"> | |
| 99 | + <el-select | |
| 100 | + v-model="infoForm.systemClass" | |
| 101 | + placeholder="请选择系统分类" | |
| 102 | + :disabled="!infoForm.systemType" | |
| 103 | + style="width: 100%" | |
| 104 | + > | |
| 105 | + <el-option | |
| 106 | + v-for="item in systemClassOptions" | |
| 107 | + :key="item.Id" | |
| 108 | + :label="item.ClassName" | |
| 109 | + :value="item.Id" | |
| 110 | + > | |
| 111 | + </el-option> | |
| 112 | + </el-select> | |
| 113 | + </el-form-item> | |
| 114 | + </el-col> | |
| 115 | + <el-col :span="12"> | |
| 116 | + <el-form-item label="备案号" prop="systemRecordNumber"> | |
| 117 | + <el-input | |
| 118 | + v-model="infoForm.systemRecordNumber" | |
| 119 | + placeholder="请输入备案号" | |
| 120 | + maxlength="200" | |
| 121 | + ></el-input> | |
| 122 | + </el-form-item> | |
| 123 | + </el-col> | |
| 124 | + <el-col :span="12"> | |
| 125 | + <el-form-item label="备案许可证" prop="recordLicense"> | |
| 126 | + <el-input | |
| 127 | + v-model="infoForm.recordLicense" | |
| 128 | + placeholder="请输入备案许可证" | |
| 129 | + maxlength="200" | |
| 130 | + ></el-input> | |
| 131 | + </el-form-item> | |
| 132 | + </el-col> | |
| 133 | + <el-col :span="12"> | |
| 134 | + <el-form-item label="归属平台" prop="platform"> | |
| 135 | + <el-input | |
| 136 | + v-model="infoForm.platform" | |
| 137 | + placeholder="请输入归属平台" | |
| 138 | + maxlength="200" | |
| 139 | + ></el-input> | |
| 140 | + </el-form-item> | |
| 141 | + </el-col> | |
| 142 | + <el-col :span="12"> | |
| 143 | + <el-form-item label="域名" prop="domain"> | |
| 144 | + <el-input | |
| 145 | + v-model="infoForm.domain" | |
| 146 | + placeholder="请输入域名" | |
| 147 | + maxlength="200" | |
| 148 | + ></el-input> | |
| 149 | + </el-form-item> | |
| 150 | + </el-col> | |
| 151 | + <el-col :span="12"> | |
| 152 | + <el-form-item label="下载量" prop="systemDownloadVolume"> | |
| 153 | + <el-input | |
| 154 | + v-model.number="infoForm.systemDownloadVolume" | |
| 155 | + maxlength="200" | |
| 156 | + placeholder="请输入下载量" | |
| 157 | + ></el-input> | |
| 158 | + </el-form-item> | |
| 159 | + </el-col> | |
| 160 | + <el-col :span="12"> | |
| 161 | + <el-form-item label="版本" prop="version"> | |
| 162 | + <el-input | |
| 163 | + v-model="infoForm.version" | |
| 164 | + maxlength="200" | |
| 165 | + placeholder="请输入版本" | |
| 166 | + ></el-input> | |
| 167 | + </el-form-item> | |
| 168 | + </el-col> | |
| 169 | + <el-col :span="12"> | |
| 170 | + <el-form-item label="负责人姓名" prop="principalName"> | |
| 171 | + <el-input | |
| 172 | + v-model="infoForm.principalName" | |
| 173 | + maxlength="50" | |
| 174 | + placeholder="请输入负责人姓名" | |
| 175 | + ></el-input> | |
| 176 | + </el-form-item> | |
| 177 | + </el-col> | |
| 178 | + <el-col :span="12"> | |
| 179 | + <el-form-item label="负责人电话" prop="principalPhone"> | |
| 180 | + <el-input | |
| 181 | + v-model="infoForm.principalPhone" | |
| 182 | + maxlength="20" | |
| 183 | + placeholder="请输入负责人电话" | |
| 184 | + ></el-input> | |
| 185 | + </el-form-item> | |
| 186 | + </el-col> | |
| 187 | + <el-col :span="24"> | |
| 188 | + <el-form-item label="办公地址" prop="officeAddress"> | |
| 189 | + <el-input | |
| 190 | + v-model="infoForm.officeAddress" | |
| 191 | + maxlength="200" | |
| 192 | + placeholder="请输入办公地址" | |
| 193 | + ></el-input> | |
| 194 | + </el-form-item> | |
| 195 | + </el-col> | |
| 196 | + <el-col :span="24" class="icom-box"> | |
| 197 | + <el-form-item label="系统图标" prop="systemIcon"> | |
| 198 | + <el-upload | |
| 199 | + class="avatar-uploader" | |
| 200 | + action="#" | |
| 201 | + :show-file-list="false" | |
| 202 | + :limit="1" | |
| 203 | + :multiple="false" | |
| 204 | + :http-request="httpRequest" | |
| 205 | + > | |
| 206 | + <img | |
| 207 | + v-if="infoForm.systemIcon" | |
| 208 | + :src="infoForm.systemIcon" | |
| 209 | + class="avatar" | |
| 210 | + /> | |
| 211 | + <i v-else class="el-icon-plus avatar-uploader-icon"></i> | |
| 212 | + </el-upload> | |
| 213 | + </el-form-item> | |
| 214 | + </el-col> | |
| 215 | + <el-col :span="24"> | |
| 216 | + <el-form-item label="所属区县" prop="areaId"> | |
| 217 | + <el-radio-group | |
| 218 | + v-model="infoForm.areaId" | |
| 219 | + placeholder="请选择所属区县" | |
| 220 | + style="line-height: 22px" | |
| 221 | + > | |
| 222 | + <el-radio | |
| 223 | + v-for="v in areaOptions" | |
| 224 | + :key="v.id" | |
| 225 | + :label="v.id" | |
| 226 | + >{{ v.fullName }}</el-radio | |
| 227 | + > | |
| 228 | + </el-radio-group> | |
| 229 | + </el-form-item> | |
| 230 | + </el-col> | |
| 231 | + </el-row> | |
| 232 | + </el-form> | |
| 233 | + </el-col> | |
| 234 | + <el-col :span="12"> | |
| 235 | + <el-col :span="24"> 修改记录: </el-col> | |
| 236 | + <el-col :span="24"> | |
| 237 | + <el-timeline> | |
| 238 | + <el-timeline-item | |
| 239 | + timestamp="2018/4/12" | |
| 240 | + placement="top" | |
| 241 | + v-for="v in updataRecordList" | |
| 242 | + :key="v.id" | |
| 243 | + > | |
| 244 | + <el-card> | |
| 245 | + <h4> | |
| 246 | + 更新 | |
| 247 | + <p v-for="(item, index) in v.updataList" :key="index"> | |
| 248 | + 将“{{ infoKeyNameObj[item.PropertyName] }}”从“{{ | |
| 249 | + item.OldValue | |
| 250 | + }}”改为“{{ item.NewValue }}” | |
| 251 | + </p> | |
| 252 | + </h4> | |
| 253 | + <p>{{ v.creatorUserId }} 提交于 {{ v.updataTime }}</p> | |
| 254 | + </el-card> | |
| 255 | + </el-timeline-item> | |
| 256 | + </el-timeline> | |
| 257 | + </el-col> | |
| 258 | + </el-col> | |
| 259 | + </el-row> | |
| 260 | + <span slot="footer" class="dialog-footer"> | |
| 261 | + <el-button @click="visible = false">取消</el-button> | |
| 262 | + </span> | |
| 263 | + </el-dialog> | |
| 264 | + </div> | |
| 265 | +</template> | |
| 266 | + | |
| 267 | +<script> | |
| 268 | +import { getCompanyInfoList, getCompanyInfoById } from "@/api/company"; | |
| 269 | +import { getSystemTypeList, uploader } from "@/api/common"; | |
| 270 | +import { getSystemClassSelect } from "@/api/systemClass"; | |
| 271 | +import { getAreaSelect } from "@/api/area"; | |
| 272 | +import { | |
| 273 | + addSystem, | |
| 274 | + updataSystem, | |
| 275 | + getSystemDetail, | |
| 276 | + getUpdataRecord, | |
| 277 | +} from "@/api/info"; | |
| 278 | +export default { | |
| 279 | + name: "infoForm", | |
| 280 | + props: { | |
| 281 | + type: { | |
| 282 | + type: String, | |
| 283 | + default: "add", | |
| 284 | + }, | |
| 285 | + systemId: { | |
| 286 | + type: String, | |
| 287 | + default: "", | |
| 288 | + }, | |
| 289 | + }, | |
| 290 | + data() { | |
| 291 | + return { | |
| 292 | + visible: false, | |
| 293 | + infoForm_loading: false, | |
| 294 | + activeNames: [], | |
| 295 | + infoForm: { | |
| 296 | + companyId: "", // 主体企业 | |
| 297 | + systemType: "", // 系统类型 | |
| 298 | + systemName: "", // 系统名称 | |
| 299 | + systemClass: "", // 系统分类 | |
| 300 | + systemRecordNumber: "", | |
| 301 | + recordLicense: "", | |
| 302 | + platform: "", | |
| 303 | + domain: "", | |
| 304 | + systemDownloadVolume: "", | |
| 305 | + version: "", | |
| 306 | + principalName: "", | |
| 307 | + principalPhone: "", | |
| 308 | + officeAddress: "", | |
| 309 | + systemIcon: "", | |
| 310 | + areaId: "", | |
| 311 | + }, | |
| 312 | + infoRules: { | |
| 313 | + systemName: { | |
| 314 | + required: true, | |
| 315 | + message: "请输入系统名称", | |
| 316 | + trigger: "blur", | |
| 317 | + }, | |
| 318 | + systemClass: { | |
| 319 | + required: true, | |
| 320 | + message: "请输入系统分类", | |
| 321 | + trigger: "change", | |
| 322 | + }, | |
| 323 | + systemType: { | |
| 324 | + required: true, | |
| 325 | + message: "请输入系统类型", | |
| 326 | + trigger: "change", | |
| 327 | + }, | |
| 328 | + companyId: { | |
| 329 | + required: true, | |
| 330 | + message: "请输入主体企业", | |
| 331 | + trigger: "change", | |
| 332 | + }, | |
| 333 | + areaId: { | |
| 334 | + required: true, | |
| 335 | + message: "请输入所属区县", | |
| 336 | + trigger: "change", | |
| 337 | + }, | |
| 338 | + pincipalPhone: { | |
| 339 | + pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, | |
| 340 | + message: "请输入正确的手机号码", | |
| 341 | + trigger: "blur", | |
| 342 | + }, | |
| 343 | + }, | |
| 344 | + value: "", | |
| 345 | + companyOptions: [], | |
| 346 | + listQuery_company: { | |
| 347 | + pageIndex: 1, | |
| 348 | + pageSize: 10, | |
| 349 | + }, | |
| 350 | + total_company: 0, | |
| 351 | + isShowCompanyInfo: false, | |
| 352 | + companyInfo: {}, | |
| 353 | + systemTypeOptions: [], | |
| 354 | + systemClassOptions: [], | |
| 355 | + areaOptions: [], | |
| 356 | + updataRecordList: [], | |
| 357 | + infoKeyNameObj: { | |
| 358 | + CompanyId: "主体企业", | |
| 359 | + SystemType: "系统类型", | |
| 360 | + SystemName: "系统名称", | |
| 361 | + SystemClass: "系统分类", | |
| 362 | + SystemRecordNumber: "备案号", | |
| 363 | + RecordLicense: "备案许可证", | |
| 364 | + Platform: "归属平坦", | |
| 365 | + Domain: "域名", | |
| 366 | + SystemDownloadVolume: "下载量", | |
| 367 | + Version: "版本", | |
| 368 | + PrincipalName: "负责人姓名", | |
| 369 | + PrincipalPhone: "负责人电话", | |
| 370 | + OfficeAddress: "办公地址", | |
| 371 | + SystemIcon: "系统图标", | |
| 372 | + AreaId: "所属区县", | |
| 373 | + }, | |
| 374 | + }; | |
| 375 | + }, | |
| 376 | + watch: {}, | |
| 377 | + mounted() {}, | |
| 378 | + created() {}, | |
| 379 | + methods: { | |
| 380 | + // 请求公司列表 | |
| 381 | + async initCompanyList() { | |
| 382 | + let { data } = await getCompanyInfoList(this.listQuery_company); | |
| 383 | + this.companyOptions = [...this.companyOptions, ...data.list]; | |
| 384 | + this.total_company = data.pagination.total; | |
| 385 | + }, | |
| 386 | + // 无限下拉 | |
| 387 | + nextCompanyList() { | |
| 388 | + if (total_company == this.listQuery_company.length) return; | |
| 389 | + this.listQuery_company.pageIndex++; | |
| 390 | + this.initCompanyList(); | |
| 391 | + }, | |
| 392 | + async companyChange(val) { | |
| 393 | + // 公司信息 | |
| 394 | + let { data } = await getCompanyInfoById(val); | |
| 395 | + this.companyInfo = data; | |
| 396 | + this.isShowCompanyInfo = true; | |
| 397 | + }, | |
| 398 | + // 系统类型 | |
| 399 | + async initSystemTypeList() { | |
| 400 | + let { data } = await getSystemTypeList(); | |
| 401 | + this.systemTypeOptions = data; | |
| 402 | + }, | |
| 403 | + async systemTypeChange(val) { | |
| 404 | + // 系统分类 | |
| 405 | + let { data } = await getSystemClassSelect({ systemType: val }); | |
| 406 | + this.systemClassOptions = data; | |
| 407 | + }, | |
| 408 | + // 文件上传-------------------- | |
| 409 | + httpRequest(file) { | |
| 410 | + uploader({ | |
| 411 | + type: 1, | |
| 412 | + file: file.file, | |
| 413 | + }).then((res) => { | |
| 414 | + console.log(res, "上传成功"); | |
| 415 | + }); | |
| 416 | + }, | |
| 417 | + // 文件上传-------------------- | |
| 418 | + | |
| 419 | + async initAreaTypeList() { | |
| 420 | + let { data } = await getAreaSelect(); | |
| 421 | + this.areaOptions = data; | |
| 422 | + }, | |
| 423 | + reset() { | |
| 424 | + for (let key in this.infoForm) { | |
| 425 | + this.infoForm[key] = undefined; | |
| 426 | + } | |
| 427 | + this.companyOptions = []; | |
| 428 | + this.listQuery_company = { | |
| 429 | + pageIndex: 1, | |
| 430 | + pageSize: 10, | |
| 431 | + }; | |
| 432 | + this.total_company = 0; | |
| 433 | + this.companyInfo = {}; | |
| 434 | + this.isShowCompanyInfo = false; | |
| 435 | + }, | |
| 436 | + close() { | |
| 437 | + this.reset(); | |
| 438 | + this.visible = false; | |
| 439 | + }, | |
| 440 | + async openDialog() { | |
| 441 | + this.visible = true; | |
| 442 | + this.infoForm_loading = true; | |
| 443 | + await this.initCompanyList(); | |
| 444 | + await this.initSystemTypeList(); | |
| 445 | + await this.initAreaTypeList(); | |
| 446 | + await this.initForm(); | |
| 447 | + await this.initUpdataRecord(); | |
| 448 | + this.infoForm_loading = false; | |
| 449 | + }, | |
| 450 | + async initUpdataRecord() { | |
| 451 | + await getUpdataRecord({ | |
| 452 | + id: this.systemId, | |
| 453 | + pageIndex: 1, | |
| 454 | + pageSize: 10, | |
| 455 | + }).then(({ data }) => { | |
| 456 | + data.list.forEach((item) => { | |
| 457 | + let date = new Date(item.creatorTime * 1000); | |
| 458 | + item.updataTime = this.$m(date).format("YYYY-MM-DD HH:mm:ss"); | |
| 459 | + item.updataList = JSON.parse(item.content); | |
| 460 | + }); | |
| 461 | + this.updataRecordList = data.list; | |
| 462 | + console.log(this.updataRecordList, "更新记录"); | |
| 463 | + }); | |
| 464 | + }, | |
| 465 | + async initForm() { | |
| 466 | + let { data } = await getSystemDetail(this.systemId); | |
| 467 | + this.infoForm = data; | |
| 468 | + this.systemTypeChange(data.systemType); | |
| 469 | + await this.companyChange(data.companyId); | |
| 470 | + this.$forceUpdate(); | |
| 471 | + }, | |
| 472 | + }, | |
| 473 | +}; | |
| 474 | +</script> | |
| 475 | +<style lang="scss" scoped> | |
| 476 | +.dialog-box { | |
| 477 | + :deep(.el-dialog__body) { | |
| 478 | + height: 60vh; | |
| 479 | + overflow-y: scroll; | |
| 480 | + } | |
| 481 | +} | |
| 482 | +.company-info { | |
| 483 | + display: flex; | |
| 484 | + flex-direction: row; | |
| 485 | + justify-content: flex-start; | |
| 486 | + background: rgba(187, 187, 187, 0.23); | |
| 487 | + margin-left: 80px; | |
| 488 | + padding: 10px 20px; | |
| 489 | + border-radius: 10px; | |
| 490 | + width: 80%; | |
| 491 | + margin-bottom: 10px; | |
| 492 | + .company-info-items { | |
| 493 | + width: 50%; | |
| 494 | + div { | |
| 495 | + line-height: 20px; | |
| 496 | + } | |
| 497 | + } | |
| 498 | +} | |
| 499 | +.icom-box { | |
| 500 | + :deep(.avatar-uploader .el-upload) { | |
| 501 | + border: 1px dashed #d9d9d9; | |
| 502 | + border-radius: 6px; | |
| 503 | + cursor: pointer; | |
| 504 | + position: relative; | |
| 505 | + overflow: hidden; | |
| 506 | + &:hover { | |
| 507 | + border-color: #409eff; | |
| 508 | + } | |
| 509 | + .avatar-uploader-icon { | |
| 510 | + font-size: 28px; | |
| 511 | + color: #8c939d; | |
| 512 | + width: 100px; | |
| 513 | + height: 100px; | |
| 514 | + line-height: 100px; | |
| 515 | + text-align: center; | |
| 516 | + } | |
| 517 | + .avatar { | |
| 518 | + width: 100px; | |
| 519 | + height: 100px; | |
| 520 | + display: block; | |
| 521 | + } | |
| 522 | + } | |
| 523 | +} | |
| 524 | +</style> | ... | ... |
src/components/Pagination/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div :class="{'hidden':hidden}" class="pagination-container"> | |
| 3 | + <el-pagination | |
| 4 | + :background="background" | |
| 5 | + :current-page.sync="currentPage" | |
| 6 | + :page-size.sync="pageSize" | |
| 7 | + :layout="layout" | |
| 8 | + :page-sizes="pageSizes" | |
| 9 | + :pager-count="pagerCount" | |
| 10 | + :total="total" | |
| 11 | + v-bind="$attrs" | |
| 12 | + @size-change="handleSizeChange" | |
| 13 | + @current-change="handleCurrentChange" | |
| 14 | + /> | |
| 15 | + </div> | |
| 16 | +</template> | |
| 17 | + | |
| 18 | +<script> | |
| 19 | +import { scrollTo } from '@/utils/scroll-to' | |
| 20 | + | |
| 21 | +export default { | |
| 22 | + name: 'Pagination', | |
| 23 | + props: { | |
| 24 | + total: { | |
| 25 | + required: true, | |
| 26 | + type: Number | |
| 27 | + }, | |
| 28 | + page: { | |
| 29 | + type: Number, | |
| 30 | + default: 1 | |
| 31 | + }, | |
| 32 | + limit: { | |
| 33 | + type: Number, | |
| 34 | + default: 20 | |
| 35 | + }, | |
| 36 | + pageSizes: { | |
| 37 | + type: Array, | |
| 38 | + default() { | |
| 39 | + return [10, 20, 30, 50] | |
| 40 | + } | |
| 41 | + }, | |
| 42 | + // 移动端页码按钮的数量端默认值5 | |
| 43 | + pagerCount: { | |
| 44 | + type: Number, | |
| 45 | + default: document.body.clientWidth < 992 ? 5 : 7 | |
| 46 | + }, | |
| 47 | + layout: { | |
| 48 | + type: String, | |
| 49 | + default: 'total, sizes, prev, pager, next, jumper' | |
| 50 | + }, | |
| 51 | + background: { | |
| 52 | + type: Boolean, | |
| 53 | + default: true | |
| 54 | + }, | |
| 55 | + autoScroll: { | |
| 56 | + type: Boolean, | |
| 57 | + default: true | |
| 58 | + }, | |
| 59 | + hidden: { | |
| 60 | + type: Boolean, | |
| 61 | + default: false | |
| 62 | + } | |
| 63 | + }, | |
| 64 | + data() { | |
| 65 | + return { | |
| 66 | + }; | |
| 67 | + }, | |
| 68 | + computed: { | |
| 69 | + currentPage: { | |
| 70 | + get() { | |
| 71 | + return this.page | |
| 72 | + }, | |
| 73 | + set(val) { | |
| 74 | + this.$emit('update:page', val) | |
| 75 | + } | |
| 76 | + }, | |
| 77 | + pageSize: { | |
| 78 | + get() { | |
| 79 | + return this.limit | |
| 80 | + }, | |
| 81 | + set(val) { | |
| 82 | + this.$emit('update:limit', val) | |
| 83 | + } | |
| 84 | + } | |
| 85 | + }, | |
| 86 | + methods: { | |
| 87 | + handleSizeChange(val) { | |
| 88 | + if (this.currentPage * val > this.total) { | |
| 89 | + this.currentPage = 1 | |
| 90 | + } | |
| 91 | + this.$emit('pagination', { page: this.currentPage, limit: val }) | |
| 92 | + if (this.autoScroll) { | |
| 93 | + scrollTo(0, 800) | |
| 94 | + } | |
| 95 | + }, | |
| 96 | + handleCurrentChange(val) { | |
| 97 | + this.$emit('pagination', { page: val, limit: this.pageSize }) | |
| 98 | + if (this.autoScroll) { | |
| 99 | + scrollTo(0, 800) | |
| 100 | + } | |
| 101 | + } | |
| 102 | + } | |
| 103 | +} | |
| 104 | +</script> | |
| 105 | + | |
| 106 | +<style scoped> | |
| 107 | +.pagination-container { | |
| 108 | + background: #fff; | |
| 109 | + padding: 32px 16px; | |
| 110 | +} | |
| 111 | +.pagination-container.hidden { | |
| 112 | + display: none; | |
| 113 | +} | |
| 114 | +</style> | ... | ... |
src/components/index.js
| ... | ... | @@ -2,11 +2,16 @@ import InfoForm from '@/components/InfoForm' |
| 2 | 2 | import CompanyForm from '@/components/CompanyForm' |
| 3 | 3 | import PasswordForm from '@/components/PasswordForm' |
| 4 | 4 | import RegisterForm from '@/components/RegisterForm' |
| 5 | +import InfoEditRecord from '@/components/InfoEditRecord' | |
| 6 | +import Pagination from '@/components/Pagination' | |
| 7 | + | |
| 5 | 8 | export default { |
| 6 | 9 | install(Vue, options) { |
| 7 | 10 | Vue.component('InfoForm', InfoForm) |
| 8 | 11 | Vue.component('CompanyForm', CompanyForm) |
| 9 | 12 | Vue.component('PasswordForm', PasswordForm) |
| 10 | 13 | Vue.component('RegisterForm', RegisterForm) |
| 14 | + Vue.component('InfoEditRecord', InfoEditRecord) | |
| 15 | + Vue.component('Pagination', Pagination) | |
| 11 | 16 | } |
| 12 | 17 | } |
| 13 | 18 | \ No newline at end of file | ... | ... |
src/main.js
| ... | ... | @@ -7,8 +7,10 @@ import ElementUI from 'element-ui'; |
| 7 | 7 | import 'element-ui/lib/theme-chalk/index.css'; |
| 8 | 8 | import store from './store' |
| 9 | 9 | import './permission' |
| 10 | +import moment from "moment"; | |
| 10 | 11 | |
| 11 | 12 | Vue.config.productionTip = false |
| 13 | +Vue.prototype.$m = moment | |
| 12 | 14 | Vue.use(ElementUI); |
| 13 | 15 | // 批量引入组件 |
| 14 | 16 | import components from './components' | ... | ... |
src/router/index.js
| 1 | 1 | |
| 2 | 2 | import Vue from "vue"; |
| 3 | 3 | import VueRouter from "vue-router"; |
| 4 | -import Layout from '@/views/HomePage.vue' | |
| 4 | +import Layout from '@/views/homePage/HomePage.vue' | |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | Vue.use(VueRouter); |
| ... | ... | @@ -17,7 +17,7 @@ const router = new VueRouter({ |
| 17 | 17 | { |
| 18 | 18 | path: '/homePage', |
| 19 | 19 | name: 'homePage', |
| 20 | - component: () => import('@/components/Overview.vue'), | |
| 20 | + component: () => import('@/views/overView/Overview.vue'), | |
| 21 | 21 | meta: { title: '首页', icon: 'dashboard', affix: true } |
| 22 | 22 | }, |
| 23 | 23 | ] |
| ... | ... | @@ -30,7 +30,7 @@ const router = new VueRouter({ |
| 30 | 30 | { |
| 31 | 31 | path: '/infoList', |
| 32 | 32 | name: 'infoList', |
| 33 | - component: () => import('@/components/InfoList.vue'), | |
| 33 | + component: () => import('@/views/systemPage/InfoList.vue'), | |
| 34 | 34 | meta: { title: '系统', icon: 'dashboard', affix: true } |
| 35 | 35 | }, |
| 36 | 36 | ] | ... | ... |
src/store/modules/permission.js
| 1 | 1 | // import auth from '@/plugins/auth' |
| 2 | 2 | import router, { constantRoutes, dynamicRoutes } from '@/router' |
| 3 | 3 | // import { getRouters } from '@/api/menu' |
| 4 | -import Layout from '@/views/HomePage.vue' | |
| 4 | +import Layout from '@/views/homePage/HomePage.vue' | |
| 5 | 5 | import ParentView from '@/components/ParentView' |
| 6 | 6 | |
| 7 | 7 | const permission = { | ... | ... |
src/utils/scroll-to.js
0 → 100644
| 1 | +Math.easeInOutQuad = function(t, b, c, d) { | |
| 2 | + t /= d / 2 | |
| 3 | + if (t < 1) { | |
| 4 | + return c / 2 * t * t + b | |
| 5 | + } | |
| 6 | + t-- | |
| 7 | + return -c / 2 * (t * (t - 2) - 1) + b | |
| 8 | +} | |
| 9 | + | |
| 10 | +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts | |
| 11 | +var requestAnimFrame = (function() { | |
| 12 | + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } | |
| 13 | +})() | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Because it's so fucking difficult to detect the scrolling element, just move them all | |
| 17 | + * @param {number} amount | |
| 18 | + */ | |
| 19 | +function move(amount) { | |
| 20 | + document.documentElement.scrollTop = amount | |
| 21 | + document.body.parentNode.scrollTop = amount | |
| 22 | + document.body.scrollTop = amount | |
| 23 | +} | |
| 24 | + | |
| 25 | +function position() { | |
| 26 | + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop | |
| 27 | +} | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * @param {number} to | |
| 31 | + * @param {number} duration | |
| 32 | + * @param {Function} callback | |
| 33 | + */ | |
| 34 | +export function scrollTo(to, duration, callback) { | |
| 35 | + const start = position() | |
| 36 | + const change = to - start | |
| 37 | + const increment = 20 | |
| 38 | + let currentTime = 0 | |
| 39 | + duration = (typeof (duration) === 'undefined') ? 500 : duration | |
| 40 | + var animateScroll = function() { | |
| 41 | + // increment the time | |
| 42 | + currentTime += increment | |
| 43 | + // find the value with the quadratic in-out easing function | |
| 44 | + var val = Math.easeInOutQuad(currentTime, start, change, duration) | |
| 45 | + // move the document.body | |
| 46 | + move(val) | |
| 47 | + // do the animation unless its over | |
| 48 | + if (currentTime < duration) { | |
| 49 | + requestAnimFrame(animateScroll) | |
| 50 | + } else { | |
| 51 | + if (callback && typeof (callback) === 'function') { | |
| 52 | + // the animation is done so lets callback | |
| 53 | + callback() | |
| 54 | + } | |
| 55 | + } | |
| 56 | + } | |
| 57 | + animateScroll() | |
| 58 | +} | ... | ... |
src/views/Systeminfo/AddDialog.vue deleted
| 1 | -<template> | |
| 2 | - <div class="addDialog"> | |
| 3 | - <el-form :model="infoForm" size="small" label-width="100px"> | |
| 4 | - <el-row :gutter="20"> | |
| 5 | - <el-col :span="24"> | |
| 6 | - <el-col :span="12"> | |
| 7 | - <el-form-item label="主体企业"> | |
| 8 | - <el-input | |
| 9 | - v-model="infoForm.name" | |
| 10 | - placeholder="请选择主体企业" | |
| 11 | - ></el-input> | |
| 12 | - </el-form-item> | |
| 13 | - </el-col> | |
| 14 | - <el-col :span="12"> | |
| 15 | - <el-button | |
| 16 | - type="text" | |
| 17 | - icon="el-icon-circle-plus-outline" | |
| 18 | - size="small" | |
| 19 | - >点击新增企业</el-button | |
| 20 | - > | |
| 21 | - </el-col> | |
| 22 | - </el-col> | |
| 23 | - <el-col :span="24" class="company-info"> | |
| 24 | - <el-col :span="12">企业归属:武侯区</el-col> | |
| 25 | - <el-col :span="12">社会信用代码:暂无</el-col> | |
| 26 | - <el-col :span="12">联系人:张三</el-col> | |
| 27 | - <el-col :span="12">联系电话:1358888888</el-col> | |
| 28 | - <el-col :span="12">公司地址:成都市茂业中心操作</el-col> | |
| 29 | - </el-col> | |
| 30 | - <el-col :span="24"> | |
| 31 | - <el-form-item label="系统类型"> | |
| 32 | - <el-input | |
| 33 | - v-model="infoForm.name" | |
| 34 | - placeholder="请选择系统类型" | |
| 35 | - ></el-input> | |
| 36 | - </el-form-item> | |
| 37 | - </el-col> | |
| 38 | - <el-col :span="12"> | |
| 39 | - <el-form-item label="系统分类"> | |
| 40 | - <el-input | |
| 41 | - v-model="infoForm.name" | |
| 42 | - placeholder="请选择系统分类" | |
| 43 | - ></el-input> | |
| 44 | - </el-form-item> | |
| 45 | - </el-col> | |
| 46 | - <el-col :span="12"> | |
| 47 | - <el-form-item label="备案号"> | |
| 48 | - <el-input | |
| 49 | - v-model="infoForm.name" | |
| 50 | - placeholder="请输入备案号" | |
| 51 | - ></el-input> | |
| 52 | - </el-form-item> | |
| 53 | - </el-col> | |
| 54 | - <el-col :span="12"> | |
| 55 | - <el-form-item label="备案许可证"> | |
| 56 | - <el-input | |
| 57 | - v-model="infoForm.name" | |
| 58 | - placeholder="请输入备案许可证" | |
| 59 | - ></el-input> | |
| 60 | - </el-form-item> | |
| 61 | - </el-col> | |
| 62 | - <el-col :span="12"> | |
| 63 | - <el-form-item label="归属平台"> | |
| 64 | - <el-input | |
| 65 | - v-model="infoForm.name" | |
| 66 | - placeholder="请输入归属平台" | |
| 67 | - ></el-input> | |
| 68 | - </el-form-item> | |
| 69 | - </el-col> | |
| 70 | - <el-col :span="12"> | |
| 71 | - <el-form-item label="域名"> | |
| 72 | - <el-input | |
| 73 | - v-model="infoForm.name" | |
| 74 | - placeholder="请输入域名" | |
| 75 | - ></el-input> | |
| 76 | - </el-form-item> | |
| 77 | - </el-col> | |
| 78 | - <el-col :span="12"> | |
| 79 | - <el-form-item label="下载量"> | |
| 80 | - <el-input | |
| 81 | - v-model="infoForm.name" | |
| 82 | - placeholder="请输入下载量" | |
| 83 | - ></el-input> | |
| 84 | - </el-form-item> | |
| 85 | - </el-col> | |
| 86 | - <el-col :span="12"> | |
| 87 | - <el-form-item label="版本"> | |
| 88 | - <el-input | |
| 89 | - v-model="infoForm.name" | |
| 90 | - placeholder="请输入版本" | |
| 91 | - ></el-input> | |
| 92 | - </el-form-item> | |
| 93 | - </el-col> | |
| 94 | - <el-col :span="12"> | |
| 95 | - <el-form-item label="负责人姓名"> | |
| 96 | - <el-input | |
| 97 | - v-model="infoForm.name" | |
| 98 | - placeholder="请输入负责人姓名" | |
| 99 | - ></el-input> | |
| 100 | - </el-form-item> | |
| 101 | - </el-col> | |
| 102 | - <el-col :span="12"> | |
| 103 | - <el-form-item label="负责人电话"> | |
| 104 | - <el-input | |
| 105 | - v-model="infoForm.name" | |
| 106 | - placeholder="请输入负责人电话" | |
| 107 | - ></el-input> | |
| 108 | - </el-form-item> | |
| 109 | - </el-col> | |
| 110 | - <el-col :span="24"> | |
| 111 | - <el-form-item label="办公地址"> | |
| 112 | - <el-input | |
| 113 | - v-model="infoForm.name" | |
| 114 | - placeholder="请输入办公地址" | |
| 115 | - ></el-input> | |
| 116 | - </el-form-item> | |
| 117 | - </el-col> | |
| 118 | - <el-col :span="24"> | |
| 119 | - <el-form-item label="系统图标"> | |
| 120 | - <el-input | |
| 121 | - v-model="infoForm.name" | |
| 122 | - placeholder="请输入系统图标" | |
| 123 | - ></el-input> | |
| 124 | - </el-form-item> | |
| 125 | - </el-col> | |
| 126 | - <el-col :span="24"> | |
| 127 | - <el-form-item label="所属区县"> | |
| 128 | - <el-input | |
| 129 | - v-model="infoForm.name" | |
| 130 | - placeholder="请输入所属区县" | |
| 131 | - ></el-input> | |
| 132 | - </el-form-item> | |
| 133 | - </el-col> | |
| 134 | - </el-row> | |
| 135 | - </el-form> | |
| 136 | - <div> | |
| 137 | - <el-button @click="$emit('close')">取 消</el-button> | |
| 138 | - <el-button type="primary" @click="$emit('close')">确 定</el-button> | |
| 139 | - </div> | |
| 140 | - </div> | |
| 141 | -</template> | |
| 142 | - | |
| 143 | -<script> | |
| 144 | -import { getCompanyInfoList } from "@/api/company"; | |
| 145 | -export default { | |
| 146 | - name: "AddDialog", | |
| 147 | - props: [], | |
| 148 | - data() { | |
| 149 | - return { | |
| 150 | - infoForm: { | |
| 151 | - name: "", | |
| 152 | - }, | |
| 153 | - value: "", | |
| 154 | - companyOptions: [], | |
| 155 | - options: [{ value: 1, label: "选项1" }], | |
| 156 | - dialogFormVisible: false, | |
| 157 | - }; | |
| 158 | - }, | |
| 159 | - mounted() { | |
| 160 | - this.getAllCompanyList(); | |
| 161 | - }, | |
| 162 | - methods: { | |
| 163 | - // 请求公司列表 | |
| 164 | - getAllCompanyList() { | |
| 165 | - getCompanyInfoList().then((res) => { | |
| 166 | - console.log(res, '全部公司信息'); | |
| 167 | - }); | |
| 168 | - }, | |
| 169 | - }, | |
| 170 | -}; | |
| 171 | -</script> | |
| 172 | - | |
| 173 | -<style></style> |
src/views/HomePage.vue renamed to src/views/homePage/HomePage.vue
src/components/Header.vue renamed to src/views/homePage/components/Header.vue
src/components/Overview.vue renamed to src/views/overView/Overview.vue
src/components/InfoList.vue renamed to src/views/systemPage/InfoList.vue
| ... | ... | @@ -44,7 +44,12 @@ |
| 44 | 44 | > |
| 45 | 45 | <el-button type="primary" size="small">修改</el-button> |
| 46 | 46 | </infoForm> |
| 47 | - <el-button type="success" size="small">查看记录</el-button> | |
| 47 | + <InfoEditRecord | |
| 48 | + style="display: inline-block" | |
| 49 | + :systemId="scope.row.Id" | |
| 50 | + > | |
| 51 | + <el-button type="success" size="small">查看记录</el-button> | |
| 52 | + </InfoEditRecord> | |
| 48 | 53 | </template> |
| 49 | 54 | </el-table-column> |
| 50 | 55 | </el-table> |
| ... | ... | @@ -97,7 +102,6 @@ export default { |
| 97 | 102 | ContactPhone: v.compayInfo.ContactPhone, |
| 98 | 103 | Id: v.SysytemInfo.Id, |
| 99 | 104 | }; |
| 100 | - console.log(obj); | |
| 101 | 105 | list.push(obj); |
| 102 | 106 | }); |
| 103 | 107 | this.infoDataList = list; | ... | ... |