|
@@ -2,7 +2,6 @@
|
|
|
<div class="data-info">
|
|
|
<el-card>
|
|
|
<el-form :model="dataForm" label-width="120px">
|
|
|
-
|
|
|
<el-form-item label="分类名称:">
|
|
|
<el-input v-model="dataForm.name"></el-input>
|
|
|
</el-form-item>
|
|
@@ -12,114 +11,116 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="分类状态:">
|
|
|
- <el-select v-model="dataForm.status" placeholder="请选择分类状态" size="large" style="width:100%;">
|
|
|
- <el-option
|
|
|
- v-for="item in statusOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <el-select
|
|
|
+ v-model="dataForm.status"
|
|
|
+ placeholder="请选择分类状态"
|
|
|
+ size="large"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in statusOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
- <div style="text-align:right; margin-top:20px;">
|
|
|
- <el-button type="warning" @click="btnSave">确认保存</el-button>
|
|
|
+ <div style="text-align: right; margin-top: 20px">
|
|
|
+ <el-button type="warning" @click="btnSave">确认保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {createDocumentCategory,updateDocumentCategory,getDocumentCategoryInfo} from'@/api/document'
|
|
|
- export default{
|
|
|
- emits:['onClose'],
|
|
|
- props:{
|
|
|
- id:{
|
|
|
- type:Number,
|
|
|
- default:0
|
|
|
+import {
|
|
|
+ createDocumentCategory,
|
|
|
+ updateDocumentCategory,
|
|
|
+ getDocumentCategoryInfo,
|
|
|
+} from "@/api/document";
|
|
|
+export default {
|
|
|
+ emits: ["onClose"],
|
|
|
+ props: {
|
|
|
+ id: {
|
|
|
+ type: Number,
|
|
|
+ default: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ id: {
|
|
|
+ handler(v) {
|
|
|
+ let _this = this;
|
|
|
+ if (v == null || v <= 0) return;
|
|
|
+ _this.getInfo(v);
|
|
|
},
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
},
|
|
|
- watch:{
|
|
|
- id:{
|
|
|
- handler(v){
|
|
|
- let _this=this;
|
|
|
- if(v==null || v<=0)return;
|
|
|
- _this.getInfo(v);
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeName: "base",
|
|
|
+ categoryList: [],
|
|
|
+ dataForm: {
|
|
|
+ id: 0,
|
|
|
+ name: "",
|
|
|
+ intro: "",
|
|
|
+ status: 5,
|
|
|
+ },
|
|
|
+ statusOptions: [
|
|
|
+ {
|
|
|
+ value: "",
|
|
|
+ label: "请选择状态",
|
|
|
},
|
|
|
- immediate: true,
|
|
|
- deep: true
|
|
|
- }
|
|
|
- },
|
|
|
- data(){
|
|
|
- return{
|
|
|
- activeName:'base',
|
|
|
- categoryList:[],
|
|
|
- dataForm:{
|
|
|
- id:0,
|
|
|
- name:'',
|
|
|
- intro:"",
|
|
|
- status:5,
|
|
|
+ {
|
|
|
+ value: 5,
|
|
|
+ label: "启用",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 6,
|
|
|
+ label: "停用",
|
|
|
},
|
|
|
- statusOptions:[
|
|
|
- {
|
|
|
- value:'',
|
|
|
- label:"请选择状态"
|
|
|
- },
|
|
|
- {
|
|
|
- value:5,
|
|
|
- label:'启用'
|
|
|
- },
|
|
|
- {
|
|
|
- value:6,
|
|
|
- label:"停用"
|
|
|
- },
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //保存更新
|
|
|
+ btnSave(e) {
|
|
|
+ let _this = this;
|
|
|
+
|
|
|
+ if (_this.dataForm.id > 0) {
|
|
|
+ updateDocumentCategory(_this.dataForm).then((res) => {
|
|
|
+ if (res.code !== 200) return;
|
|
|
+ _this.$message.success("文档分类更新成功");
|
|
|
+ _this.$emit("onClose");
|
|
|
+ _this.$emit("refresh-list");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ createDocumentCategory(_this.dataForm).then((res) => {
|
|
|
+ if (res.code !== 200) return;
|
|
|
+ _this.$message.success("文档分类创建成功");
|
|
|
+ _this.$emit("onClose");
|
|
|
+ _this.$emit("refresh-list");
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
- methods:{
|
|
|
-
|
|
|
-
|
|
|
- //保存更新
|
|
|
- btnSave(e){
|
|
|
- let _this=this;
|
|
|
|
|
|
- if(_this.dataForm.id>0){
|
|
|
- updateDocumentCategory(_this.dataForm).then(res=>{
|
|
|
- if(res.status!=200)return;
|
|
|
- _this.$alert("文档分类更新成功");
|
|
|
- _this.$emit("onClose")
|
|
|
- })
|
|
|
- }else{
|
|
|
- createDocumentCategory(_this.dataForm).then(res=>{
|
|
|
-
|
|
|
- if(res.status!=200)return;
|
|
|
- _this.$alert("文档分类创建成功");
|
|
|
- _this.$emit("onClose")
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- //产品详情
|
|
|
- getInfo(id){
|
|
|
- let _this=this;
|
|
|
- let par={
|
|
|
- id:id,
|
|
|
- };
|
|
|
- getDocumentCategoryInfo(par).then(res=>{
|
|
|
- if(!res)return;
|
|
|
- if(res.status!=200)return;
|
|
|
- _this.dataForm=res.data;
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ //产品详情
|
|
|
+ getInfo(id) {
|
|
|
+ let _this = this;
|
|
|
+ let par = {
|
|
|
+ id: id,
|
|
|
+ };
|
|
|
+ getDocumentCategoryInfo(par).then((res) => {
|
|
|
+ if (res.status != 200) return;
|
|
|
+ _this.dataForm = res.data.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
- @import './dataInfo.scss'
|
|
|
+@import "./dataInfo.scss";
|
|
|
</style>
|