From c3be9d3e4d1d68f130a5410c930cbdaa0da196e2 Mon Sep 17 00:00:00 2001
From: zhangyongzhangyong <2012005003@qq.coom>
Date: Sat, 15 Feb 2020 11:00:30 +0800
Subject: [PATCH] =?UTF-8?q?=E5=93=A8=E5=8D=A1=E6=96=B0=E5=A2=9E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epidemicsentrypost-add-or-update.vue | 256 +++++++++---------
.../modules/custom/epidemicsentrypost.vue | 24 +-
src/views/modules/sys/deptmacode.vue | 6 +-
3 files changed, 147 insertions(+), 139 deletions(-)
diff --git a/src/views/modules/custom/epidemicsentrypost-add-or-update.vue b/src/views/modules/custom/epidemicsentrypost-add-or-update.vue
index a730aeae..7852898f 100644
--- a/src/views/modules/custom/epidemicsentrypost-add-or-update.vue
+++ b/src/views/modules/custom/epidemicsentrypost-add-or-update.vue
@@ -1,52 +1,32 @@
-
-
-
-
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
{{ $t('cancel') }}
{{ $t('confirm') }}
@@ -64,69 +44,27 @@ export default {
id: '',
sentryPostCode: '',
sentryPostName: '',
- thirdSentryPostId: '',
- gridId: '',
- maCodeUrl: '',
- parentDeptIds: '',
- parentDeptNames: '',
- allDeptIds: '',
- allDeptNames: '',
- delFlag: '',
- revision: '',
- createdBy: '',
- createdTime: '',
- updatedBy: '',
- updatedTime: ''
- }
+ gridId: ''
+ },
+ verifyOptions: []
}
},
computed: {
dataRule () {
return {
sentryPostCode: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
+ {
+ required: true,
+ message: this.$t('validate.required'),
+ trigger: 'blur'
+ }
],
sentryPostName: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- thirdSentryPostId: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- gridId: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- maCodeUrl: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- parentDeptIds: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- parentDeptNames: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- allDeptIds: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- allDeptNames: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- delFlag: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- revision: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- createdBy: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- createdTime: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- updatedBy: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
- ],
- updatedTime: [
- { required: true, message: this.$t('validate.required'), trigger: 'blur' }
+ {
+ required: true,
+ message: this.$t('validate.required'),
+ trigger: 'blur'
+ }
]
}
}
@@ -134,6 +72,7 @@ export default {
methods: {
init () {
this.visible = true
+ this.querySentryPostName()
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
@@ -141,40 +80,97 @@ export default {
}
})
},
+ // 哨卡名称查询(未绑定网格id的)
+ querySentryPostName () {
+ this.$http
+ .get(`custom/epidemicsentrypost/selectListSentryPostName`)
+ .then(({ data: res }) => {
+ if (res.code !== 0) {
+ return this.$message.error(res.msg)
+ }
+ this.verifyOptions = res.data
+ })
+ .catch(() => {})
+ },
+ // 根据下拉框选择的value 赋值key
+ selectModel (sentryPostName) {
+ let obj = {}
+ obj = this.verifyOptions.find((dataForm) => {
+ return this.dataForm.sentryPostName === sentryPostName
+ })
+ this.dataForm.id = obj.id
+ },
// 获取信息
getInfo () {
- this.$http.get(`/news/epidemicsentrypost/${this.dataForm.id}`).then(({ data: res }) => {
- if (res.code !== 0) {
- return this.$message.error(res.msg)
- }
- this.dataForm = {
- ...this.dataForm,
- ...res.data
- }
- }).catch(() => {})
- },
- // 表单提交
- dataFormSubmitHandle: debounce(function () {
- this.$refs['dataForm'].validate((valid) => {
- if (!valid) {
- return false
- }
- this.$http[!this.dataForm.id ? 'post' : 'put']('/news/epidemicsentrypost/', this.dataForm).then(({ data: res }) => {
+ this.$http
+ .get(`/news/epidemicsentrypost/${this.dataForm.id}`)
+ .then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
- this.$message({
- message: this.$t('prompt.success'),
- type: 'success',
- duration: 500,
- onClose: () => {
- this.visible = false
- this.$emit('refreshDataList')
- }
- })
- }).catch(() => {})
- })
- }, 1000, { 'leading': true, 'trailing': false })
+ this.dataForm = {
+ ...this.dataForm,
+ ...res.data
+ }
+ })
+ .catch(() => {})
+ },
+ // 编码校验
+ // sentryPostCodeIsRepeat () {
+ // if (this.dataForm.sentryPostCode.replace(/\s+/g, '').length === 0) {
+ // return this.$message.error('哨卡编码不可为空')
+ // }
+ // this.$http
+ // .get(`custom/epidemicsentrypost/sentryPostCodeIsRepeat/${this.dataForm.sentryPostCode}`)
+ // .then(({ data: res }) => {
+ // if (res.code !== 0) {
+ // return this.$message.error(res.msg)
+ // }
+ // if (res.data > 0) {
+ // return this.$message.error('哨卡编码不可重复')
+ // }
+ // return res.data
+ // })
+ // .catch(() => {})
+ // },
+ // 表单提交
+ dataFormSubmitHandle: debounce(
+ function () {
+ this.$refs['dataForm'].validate(valid => {
+ if (!valid) {
+ return false
+ }
+ if (this.dataForm.sentryPostCode.length > 6) {
+ return this.$message.error('哨卡编码长度不可超6位')
+ }
+ var reg = /^[0-9a-zA-Z]+$/
+ if (!reg.test(this.dataForm.sentryPostCode)) {
+ return this.$message.error('哨卡编码仅支持数字或字母')
+ }
+ this.$http[!this.dataForm.id ? 'post' : 'put'](
+ '/custom/epidemicsentrypost/',
+ this.dataForm
+ )
+ .then(({ data: res }) => {
+ if (res.code !== 0) {
+ return this.$message.error(res.msg)
+ }
+ this.$message({
+ message: this.$t('prompt.success'),
+ type: 'success',
+ duration: 500,
+ onClose: () => {
+ this.visible = false
+ this.$emit('refreshDataList')
+ }
+ })
+ })
+ .catch(() => {})
+ })
+ },
+ 1000,
+ { leading: true, trailing: false }
+ )
}
}
diff --git a/src/views/modules/custom/epidemicsentrypost.vue b/src/views/modules/custom/epidemicsentrypost.vue
index ddb76d59..525711c2 100644
--- a/src/views/modules/custom/epidemicsentrypost.vue
+++ b/src/views/modules/custom/epidemicsentrypost.vue
@@ -13,7 +13,7 @@
{{ $t('query') }}
- {{ $t('add') }}
+ {{ $t('add') }}
{{ $t('deleteBatch') }}
@@ -28,9 +28,9 @@
-
+
-
+
diff --git a/src/views/modules/sys/deptmacode.vue b/src/views/modules/sys/deptmacode.vue
index 9a8196ba..e5770303 100644
--- a/src/views/modules/sys/deptmacode.vue
+++ b/src/views/modules/sys/deptmacode.vue
@@ -116,7 +116,7 @@
@click="downloadHandle(scope.row.codeUrl)">下载
哨卡管理
+ @click="sentryManage(scope.row.gridId)">哨卡管理
{
- // this.$refs.epidemicSentryPostVisible.dataForm.id = id
+ this.$refs.epidemicSentryPost.dataForm.gridId = id
this.$refs.epidemicSentryPost.init()
})
},