Zory před 2 měsíci
rodič
revize
741f429903

+ 7 - 0
src/api/model/service.js

@@ -9,4 +9,11 @@ export default {
             return await http.get(this.url, params);
         },
     },
+    dic: {
+        url: `${config.API_URL}/service/dic`,
+        name: "-",
+        get: async function (params) {
+            return await http.get(this.url, params);
+        },
+    },
 }

+ 18 - 0
src/views/manage/school/category/components/form.vue

@@ -19,6 +19,12 @@
                     </el-form-item>
                 </el-col>
             </el-row>
+            <el-form-item label="分类属性" prop="attribute" v-loading="channelState">
+                <el-checkbox-group v-model="formData.attribute">
+                    <el-checkbox border :value="item.code" :label="item.code" v-for="(item,indx) in channelData" :key="indx">{{ item.name }}</el-checkbox>
+                </el-checkbox-group>
+                <div class="el-form-item-msg"></div>
+            </el-form-item>
             <el-form-item label="状态" prop="status">
                 <el-radio-group v-model="formData.status">
                     <el-radio-button :label="1">正常</el-radio-button>
@@ -38,6 +44,8 @@
 export default {
     data(){
         return {
+            channelData:[],
+            channelState:false,
             loading: false,
             isSaveing: false,
             mode:"add",
@@ -61,12 +69,22 @@ export default {
         open(mode = 'add'){
             this.mode = mode;
             this.visible = true;
+            this.getChannel()
             return this
         },
         //表单注入数据
         setData(data){
             this.formData = JSON.parse(JSON.stringify(data));
         },
+        async getChannel(){
+            this.channelState = true;
+            var resp = await this.$API.service.dic.get({"type":"category"});
+            this.channelState = false;
+            if (resp.code == 0) {
+                return this.$message.error(resp.msg)
+            }
+            this.channelData = resp.data;
+        },
         async submit(){
             var validate = await this.$refs.dialogForm.validate().catch(()=>{});
             if(!validate){ return false }

+ 13 - 2
src/views/manage/school/lists/components/form.vue

@@ -29,9 +29,9 @@
                         <sc-upload v-model="formData.cover"></sc-upload>
                         <div class="el-form-item-msg"></div>
                     </el-form-item>
-                    <el-form-item label="文档属性" prop="attribute">
+                    <el-form-item label="文档属性" prop="attribute" v-loading="channelState">
                         <el-checkbox-group v-model="formData.attribute">
-                            <el-checkbox border :value="item.key" :label="item.key" v-for="(item,indx) in channelData" :key="indx">{{ item.name }}</el-checkbox>
+                            <el-checkbox border :value="item.code" :label="item.code" v-for="(item,indx) in channelData" :key="indx">{{ item.name }}</el-checkbox>
                         </el-checkbox-group>
                         <div class="el-form-item-msg"></div>
                     </el-form-item>
@@ -82,6 +82,7 @@ export default {
     data() {
         return {
             categoryData:[],
+            channelState:false,
             deptsProps:{
                 value: "id",
                 label: "name"
@@ -114,6 +115,7 @@ export default {
             this.mode = mode;
             this.visible = true;
             this.getCategory()
+            this.getChannel()
             if (mode == 'add') {
                 this.formData = {
                     view:0,
@@ -127,6 +129,15 @@ export default {
         setData(data){
             this.formData = JSON.parse(JSON.stringify(data));
         },
+        async getChannel(){
+            this.channelState = true;
+            var resp = await this.$API.service.dic.get({"type":"article"});
+            this.channelState = false;
+            if (resp.code == 0) {
+                return this.$message.error(resp.msg)
+            }
+            this.channelData = resp.data;
+        },
         async getCategory(){
             var resp = await this.$API.category.list.get({"type":2});
             if (resp.code == 0) {