|
|
@@ -7,16 +7,15 @@
|
|
|
size="99%"
|
|
|
:visible.sync="dialogVisible"
|
|
|
>
|
|
|
- <div class="msg-component">
|
|
|
+ <div class="content-container">
|
|
|
<vuescroll :ops="ops" style="height: calc(100vh - 260px)">
|
|
|
<el-form ref="ruleForm" :model="formData" :rules="rules" label-position="right" label-width="100px">
|
|
|
- <el-form-item label="制度名称" prop="artTitle">
|
|
|
+ <el-form-item label="名称" prop="artTitle">
|
|
|
<el-input v-model="formData.artTitle" />
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="分类" prop="artCatId">
|
|
|
- <el-select v-model="formData.artCatId" style="width: 100%" filterable placeholder="请选择">
|
|
|
- <el-option v-for="item in regulationCatList" :key="item.artCatId" :label="item.artCatTitle" :value="item.artCatId" />
|
|
|
- </el-select>
|
|
|
+ <art-cat-selector v-model="formData.artCatId" :parent-id="parentId" />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="内容" prop="artContent">
|
|
|
@@ -38,8 +37,8 @@
|
|
|
</vuescroll>
|
|
|
|
|
|
<div class="btn-group">
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
|
|
|
- <el-button class="cancel-btn" @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button class="cancel-btn" @click="dialogVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -50,9 +49,11 @@
|
|
|
import vuescroll from 'vuescroll'
|
|
|
import { ACTION_ADD, ACTION_UPDATE } from '@/utils/actionType'
|
|
|
import FileUpload from '@/components/FileUpload/multiUpload.vue'
|
|
|
-import { createRegulation, getRegulationById, updateRegulation, getRegulationCatByList } from '@/api/aqpt/artRegulationApi'
|
|
|
+import { createArt, getArtById, updateArt } from '@/api/system/artApi'
|
|
|
+import ArtCatSelector from '@/components/ArtCatSelector/index.vue'
|
|
|
export default {
|
|
|
components: {
|
|
|
+ ArtCatSelector,
|
|
|
FileUpload,
|
|
|
vuescroll
|
|
|
},
|
|
|
@@ -82,6 +83,7 @@ export default {
|
|
|
artAuthor: '',
|
|
|
attachList: []
|
|
|
},
|
|
|
+ parentId: 1,
|
|
|
// validate rules
|
|
|
rules: {
|
|
|
artTitle: [
|
|
|
@@ -101,25 +103,13 @@ export default {
|
|
|
mounted() {
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
- // Init Regulation Category List
|
|
|
- initRegulationCatData() {
|
|
|
- getRegulationCatByList().then((resp) => {
|
|
|
- const { data } = resp
|
|
|
- this.regulationCatList = data
|
|
|
- }).catch((error) => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
// Upload List Change
|
|
|
- attchListChange(dataList) {
|
|
|
+ attachListChange(dataList) {
|
|
|
this.formData.attachList = dataList
|
|
|
},
|
|
|
|
|
|
// Add Model
|
|
|
showAddModel(artCatId, artCatTitle) {
|
|
|
- this.initRegulationCatData()
|
|
|
this.resetFormData()
|
|
|
this.actionType = ACTION_ADD
|
|
|
this.dialogVisible = true
|
|
|
@@ -129,11 +119,10 @@ export default {
|
|
|
|
|
|
// Edit Model
|
|
|
showEditModel(artId) {
|
|
|
- this.initRegulationCatData()
|
|
|
this.resetFormData()
|
|
|
this.actionType = ACTION_UPDATE
|
|
|
this.dialogVisible = true
|
|
|
- getRegulationById(artId).then((resp) => {
|
|
|
+ getArtById(artId).then((resp) => {
|
|
|
const { data } = resp
|
|
|
this.formData = data
|
|
|
}).catch((error) => {
|
|
|
@@ -159,19 +148,19 @@ export default {
|
|
|
if (valid) {
|
|
|
switch (this.actionType) {
|
|
|
case ACTION_ADD:
|
|
|
- createRegulation(this.formData).then((resp) => {
|
|
|
+ createArt(this.formData).then((resp) => {
|
|
|
const { msg } = resp
|
|
|
this.dialogVisible = false
|
|
|
this.$message.success(msg)
|
|
|
this.formSuccess()
|
|
|
- this.$message({ type: 'success', message: msg })
|
|
|
+ this.$message.success(msg)
|
|
|
}).catch((error) => {
|
|
|
console.log(error)
|
|
|
})
|
|
|
break
|
|
|
|
|
|
case ACTION_UPDATE:
|
|
|
- updateRegulation(this.formData).then((resp) => {
|
|
|
+ updateArt(this.formData).then((resp) => {
|
|
|
const { msg } = resp
|
|
|
this.dialogVisible = false
|
|
|
this.$message.success(msg)
|
|
|
@@ -190,10 +179,6 @@ export default {
|
|
|
|
|
|
formSuccess() {
|
|
|
this.$emit('formSuccess')
|
|
|
- },
|
|
|
-
|
|
|
- resetFormField(formName) {
|
|
|
- this.$refs[formName].resetFields()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -202,35 +187,35 @@ export default {
|
|
|
<style lang="scss">
|
|
|
</style>
|
|
|
<style lang="scss" scoped>
|
|
|
- .msg-component {
|
|
|
- margin: 15px;
|
|
|
- position: relative;
|
|
|
- height: calc(100% - 15px);
|
|
|
-
|
|
|
- .btn-group {
|
|
|
- position: absolute;
|
|
|
- bottom: 0;
|
|
|
- left: 0;
|
|
|
- width: 100%;
|
|
|
-
|
|
|
- .el-button {
|
|
|
- width: 120px;
|
|
|
- margin: 0 0 15px 110px;
|
|
|
- }
|
|
|
-
|
|
|
- .cancel-btn {
|
|
|
- margin-left: 30px;
|
|
|
- background: #004F7B;
|
|
|
- border-color: #004F7B;
|
|
|
- color: #FFF;
|
|
|
-
|
|
|
- &:hover {
|
|
|
- background: #026197;
|
|
|
- border-color: #026197;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+.content-container {
|
|
|
+ margin: 15px;
|
|
|
+ position: relative;
|
|
|
+ height: calc(100% - 15px);
|
|
|
+
|
|
|
+ .btn-group {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ width: 120px;
|
|
|
+ margin: 0 0 15px 110px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .cancel-btn {
|
|
|
+ margin-left: 30px;
|
|
|
+ background: #004F7B;
|
|
|
+ border-color: #004F7B;
|
|
|
+ color: #FFF;
|
|
|
|
|
|
+ &:hover {
|
|
|
+ background: #026197;
|
|
|
+ border-color: #026197;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
</style>
|