Compare commits

...

2 Commits

Author SHA1 Message Date
zhangyuan c255bb14d1 更换接口 3 years ago
zhangyuan 25cb56ddd3 good 3 years ago
  1. 29
      src/views/modules/worklog/icworklog-add-or-update.vue

29
src/views/modules/worklog/icworklog-add-or-update.vue

@ -13,6 +13,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
:disabled="item.disabled"
> >
</el-option> </el-option>
</el-select> </el-select>
@ -69,7 +70,6 @@
</el-form-item> --> </el-form-item> -->
<el-form-item label="照片" <el-form-item label="照片"
label-width="150px"
style="display:block"> style="display:block">
<el-upload :class="['avatar-uploader', {'hide': hideUploadBtn}] " <el-upload :class="['avatar-uploader', {'hide': hideUploadBtn}] "
ref="uploadPic" ref="uploadPic"
@ -102,6 +102,7 @@ export default {
return { return {
formType: '', formType: '',
visible: false, visible: false,
gridState: true,
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadvariedfile', uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadvariedfile',
logTypeArr: [], logTypeArr: [],
optionsG: [], optionsG: [],
@ -123,18 +124,11 @@ export default {
} }
}, },
created () { created () {
this.getGridList()
this.getCategrayList() this.getCategrayList()
}, },
computed: { computed: {
dataRule () { dataRule () {
return { return {
agencyId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
gridId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
title: [ title: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
@ -153,6 +147,7 @@ export default {
methods: { methods: {
init () { init () {
this.visible = true this.visible = true
this.getGridList()
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
this.dataForm.fileList = [] this.dataForm.fileList = []
@ -171,6 +166,15 @@ export default {
...this.dataForm, ...this.dataForm,
...res.data ...res.data
} }
const grid = this.optionsG.filter(item => item.value === res.data.gridId)
if (grid.length < 1) {
this.gridState = false
this.optionsG.push({label:res.data.gridName, value:res.data.gridId, disabled: true})
} else {
this.gridState = true
}
const { id } = this.$store.state.user const { id } = this.$store.state.user
if (this.dataForm.createdBy == id) { // if (this.dataForm.createdBy == id) { //
this.formType = 'update' this.formType = 'update'
@ -197,9 +201,9 @@ export default {
} }
}, },
getGridList() { getGridList() {
const { user } = this.$store.state this.optionsG = []
this.$http this.$http
.post('/gov/org/customergrid/gridoption', { agencyId: user.agencyId, purpose: 'query' }) .post('/gov/mine/agency/getmygrids')
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
@ -327,6 +331,11 @@ export default {
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
if (!this.gridState) {
this.dataForm.gridId = ''
this.gridState = true
return this.$message.error("请重新选择网格")
}
if (this.dataForm.content.length < 70) { if (this.dataForm.content.length < 70) {
return this.$message.error("内容不能少于70字") return this.$message.error("内容不能少于70字")
} }

Loading…
Cancel
Save