Jelajahi Sumber

官网案例管理

qymljy 1 tahun lalu
induk
melakukan
3b5f417cf6

+ 71 - 24
src/Form/caseManage/add.vue

@@ -31,7 +31,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="24">
-              <el-form-item label="封面" prop="image">
+              <el-form-item label="封面" prop="cover">
                 <previewImage v-if="form.cover" style="width:256px" :image="form.image" :deletebtn="true"
                               @onSuccess="clearCover"></previewImage>
                 <upload v-else btntype="image" :folderid="folderid" accept=".JPG,.PNG"
@@ -58,7 +58,22 @@
               </div>
               <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
             </template>
+            <template v-slot:opreation="scope">
+              <el-button type="text" @click="delClick(scope.data)">删除</el-button>
+            </template>
           </tableNewLayout>
+          <div  class="container normal-panel" style="text-align:right">
+            <el-pagination
+                background
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                :page-sizes="[20, 50, 100, 200]"
+                :page-size="20"
+                layout="total,sizes, prev, pager, next, jumper"
+                :total="total">
+            </el-pagination>
+          </div>
         </div>
       </div>
       <div class="fixed__btn__panel">
@@ -83,6 +98,8 @@ export default {
       dialogFormVisible:false,
       tablecols:[],
       list:[],
+      currentPage:0,
+      total:0,
       form:{
         "title": "",
         "notes": "",
@@ -90,13 +107,14 @@ export default {
         "sat_sharematerialid":0,
         "status":"新建",
         "sequence":'',
-        "image":null,
+        "image":'',
+        "cover":''
       },
       rules:{
         title: [
           { required: true, message: '请输入标题名称', trigger: 'blur' },
         ],
-        image: [
+        cover: [
           { required: true, message: '请上传封面', trigger: 'change' }
         ],
       },
@@ -106,6 +124,8 @@ export default {
         "id": "20240801134003",
         "content": {
           "sat_sharematerialid": '',
+          "pageNumber":1,
+          "pageSize":20,
           "where": {
             "condition": ""
           }
@@ -137,7 +157,7 @@ export default {
       }else {
         this.form.sat_sharematerialid = res.data.sat_sharematerialid
         this.productParam.content.sat_sharematerialid = res.data.sat_sharematerialid
-        this.productData()
+        this.productData(this.productParam.content.pageNumber = 1)
       }
     },
     onSubmit(){
@@ -152,6 +172,9 @@ export default {
           this.dialogFormVisible = false
           this.$refs.form.resetFields()
           this.$refs.editor.html = ''
+          this.form.image = ''
+          this.form.cover = ''
+          this.form.sat_sharematerialid = 0
           this.$emit('onSuccess')
         })
       })
@@ -166,6 +189,12 @@ export default {
           }
         })
       }
+      this.dialogFormVisible = false
+      this.$refs.form.resetFields()
+      this.$refs.editor.html = ''
+      this.form.image = ''
+      this.form.cover = ''
+      this.form.sat_sharematerialid = 0
     },
     clearCover() {
       this.form.cover = null
@@ -174,10 +203,10 @@ export default {
     async productData(){
       const res = await this.$api.requested(this.productParam)
       this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
     },
     async onCoverSubmit(data) {
-      // console.log(res,'上传图片1111')
-      // this.image = res.data.attachmentids[0]
       const res = await this.$api.requested({
         "classname": "system.attachment.Attachment",
         "method": "queryFileLink",
@@ -187,25 +216,8 @@ export default {
           "usetype": 'cover'//传空返回有所
         }
       })
-      console.log(res,'封面数据获取')
       this.form.cover = res.data[0].url
-      this.image = res.data[0]
-      this.queryNoticeMain()
-      // this.form.cover = JSON.parse(res.attinfos).data[0].url
-      // this.image = JSON.parse(res.attinfos).data[0]
-    },
-    async queryNoticeMain(){
-      const res = await this.$api.requested({
-        "id": "20240801133703",
-        "content": {
-          "sat_sharematerialid":this.form.sat_sharematerialid
-        }
-      })
-      this.attinfo_attachment = res.data.attinfos.filter(e => {
-        if (e.postfix !== 'mp4' && e.postfix !== 'ogg' && e.postfix !== 'webm') {
-          return e
-        }
-      })
+      this.form.image = res.data[0]
     },
     async selectData(data){
       const res = await this.$api.requested({
@@ -220,6 +232,41 @@ export default {
       this.productParam.content.sat_sharematerialid = this.form.sat_sharematerialid
       this.productData()
     },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.productParam.content.pageSize = val
+      this.productData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.productParam.content.pageNumber = val
+      this.productData()
+    },
+    delClick(data){
+      this.$confirm('确定删除该商品吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then( () => {
+        this.delSuccess(data)
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    async delSuccess(data){
+      const res = await this.$api.requested({
+        "id":20240801133903,
+        "content": {
+          "sat_sharematerial_itemsid":data.sat_sharematerial_itemsid
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData()
+      })
+    }
   },
   created() {
     this.tablecols = this.tool.tabelCol(this.$route.name).productTable.tablecols

+ 2 - 4
src/WebsiteManagement/caseManage/modules/addProduct.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-button  type="primary" size="small" @click="addBtn(drawer = true)">添加</el-button>
+    <el-button  :type="disabled?'':'primary'" size="small" @click="addBtn(drawer = true)" :disabled="disabled">添加</el-button>
     <el-drawer
         title="添加商品"
         :visible.sync="drawer"
@@ -47,7 +47,7 @@ import previewImage from '@/components/previewImage/index'
 export default {
   name: "addProduct",
   components:{tableNewLayout,previewImage},
-  props:['sat_sharematerialid'],
+  props:['sat_sharematerialid','disabled'],
   data(){
     return {
       drawer:false,
@@ -79,10 +79,8 @@ export default {
       this.list = res.data
       this.total = res.total
       this.currentPage = res.pageNumber
-      console.log(res.data,'可添加商品')
     },
     selectClick(data){
-      console.log(data)
       this.drawer = false
       this.$emit('selectData',data)
     },

+ 180 - 11
src/WebsiteManagement/caseManage/modules/detailInfo.vue

@@ -12,44 +12,213 @@
         @close="onClose">
       <div style="display: flex;justify-content: space-between;padding: 10px">
         <div>
-          资讯管理
+          案例管理
         </div>
         <div>
-<!--          <edit v-if="tool.checkAuth($route.name,'update')" :sat_noticeid="sat_noticeid" @editSuccess="detailBtn" class="inline-16" :disabled="form.status == '发布'"></edit>-->
+          <edit v-if="tool.checkAuth($route.name,'update')" :sat_sharematerialid="data.sat_sharematerialid" @editSuccess="detailBtn" class="inline-16" :disabled="form.status == '发布'"></edit>
           <el-button v-if="tool.checkAuth($route.name,'delete')" :type="form.status == '发布'?'':'primary'" size="small" @click="delBtn" :disabled="form.status == '发布'">删除</el-button>
         </div>
       </div>
+      <div class="drawer__panel" style="margin-bottom: 0px !important;">
+        <el-row :gutter="10">
+          <el-form :model="form" :rules="rules" ref="form"  size="mini" label-position="top">
+            <el-col :span="24">
+              <el-form-item label="标题" prop="title">
+                <el-input v-model="form.title" placeholder="请输入标题" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="状态" prop="status">
+                <el-radio-group v-model="form.status" disabled>
+                  <el-radio label="新建">新建</el-radio>
+                  <el-radio label="发布">发布</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="排序" prop="sequence">
+                <el-input v-model="form.sequence" placeholder="请输入排序" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="封面" prop="cover">
+                <previewImage v-if="form.cover" style="width:256px" :image="form.image"
+                              ></previewImage>
+                <upload v-else btntype="image" :folderid="folderid" accept=".JPG,.PNG"
+                        :bindData="{ ownertable: 'sat_sharematerial', ownerid: form.sat_sharematerialid, usetype: 'cover' }"
+                       ></upload>
+                <p class="info">注:建议上传图片大小130x80像素,大小不超过2M,格式为JPG/PNG</p>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="内容" prop="notes">
+                <myEditor ref="editor" :content="form.content" :id="form.sat_sharematerialid" :disabled="true"></myEditor>
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </el-row>
+        <div>
+          <div style="font-size: 16px;font-weight: bold;margin-bottom: 10px">关联产品</div>
+          <addProduct :sat_sharematerialid="form.sat_sharematerialid" style="margin-bottom: 10px" :disabled="true"></addProduct>
+          <tableNewLayout ref="tableRef" :checkbox="false" :custom="true" :data="list" :layout="tablecols"
+                          :opwidth="200" :width="true" height="300px">
+            <template v-slot:customcol="scope">
+              <div v-if="scope.column.columnname === 'itemclassfullname'">
+                {{scope.column.data.itemclass?scope.column.data.itemclass.length>0?scope.column.data.itemclass[0].itemclassfullname:'':''}}
+              </div>
+              <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+            </template>
+            <template v-slot:opreation="scope">
+              <el-button type="text" disabled>删除</el-button>
+            </template>
+          </tableNewLayout>
+          <div  class="container normal-panel" style="text-align:right">
+            <el-pagination
+                background
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                :page-sizes="[20, 50, 100, 200]"
+                :page-size="20"
+                layout="total,sizes, prev, pager, next, jumper"
+                :total="total">
+            </el-pagination>
+          </div>
+        </div>
+      </div>
     </el-drawer>
   </div>
 </template>
 
 <script>
+import edit from './edit'
+import upload from '@/components/upload/hw_obs_upload.vue'
+import previewImage from '@/components/previewImage/index.vue'
+import myEditor from '@/components/my-editor/Editor.vue'
+import tableNewLayout from '@/components/dynamic-newTable/index2'
+import addProduct from '@/WebsiteManagement/caseManage/modules/addProduct'
 export default {
   name: "detailInfo",
   props:['data'],
+  components:{edit,upload,previewImage,myEditor,tableNewLayout,addProduct},
   data(){
     return {
       dialogFormVisible:false,
+      tablecols:[],
+      list:[],
+      currentPage:0,
+      total:0,
       form:{
+        "title": "",
+        "notes": "",
+        "content": "",
+        "sat_sharematerialid":'',
+        "status":"",
+        "sequence":'',
+        "image":'',
+        "cover":''
+      },
+      rules:{
+        title: [
+          { required: true, message: '请输入标题名称', trigger: 'blur' },
+        ],
+        cover: [
+          { required: true, message: '请上传封面', trigger: 'change' }
+        ],
+      },
+      folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
+      productParam:{
+        "id": "20240801134003",
+        "content": {
+          "sat_sharematerialid": '',
+          "pageNumber":1,
+          "pageSize":20,
+          "where": {
+            "condition": ""
+          }
 
+        }
       }
     }
   },
   methods:{
-    detailBtn(){},
-    onClose(){},
-    async delBtn(){
-      console.log(this.data,this.data.sat_sharematerialid)
+    async detailBtn(){
       const res = await this.$api.requested({
-        "id":20240801133503,
+        "id":20240801133703,
         "content": {
-          "sat_sharematerialids":[this.data.sat_sharematerialid]
+          "sat_sharematerialid":this.data.sat_sharematerialid
         }
       })
-      this.tool.showMessage(res,()=>{
-        this.$emit('onSuccess')
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }else {
+        this.form = Object.assign({},this.form,res.data)
+        this.$refs.editor.html = res.data.content
+        this.queryFileLink()
+        this.productParam.content.sat_sharematerialid = res.data.sat_sharematerialid
+        this.productData(this.productParam.content.pageNumber = 1)
+      }
+    },
+    // 获取封面信息
+    async queryFileLink() {
+      this.dialogEditVisible = true
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sat_sharematerial',
+          "ownerid": this.form.sat_sharematerialid,
+          "usetype": 'cover'//传空返回有所
+        }
       })
-    }
+      this.form.image = res.data[0]
+      this.form.cover = res.data[0].url
+      /*res.data[0] ? this.image = res.data[0].url : this.image = { url: '' }*/
+    },
+    onClose(){
+      this.$emit('onSuccess')
+    },
+    async delBtn(){
+      this.$confirm('确定删除当前案例吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async() => {
+        const res = await this.$api.requested({
+          "id":20240801133503,
+          "content": {
+            "sat_sharematerialids":[this.data.sat_sharematerialid]
+          }
+        })
+        this.tool.showMessage(res,()=>{
+          this.$emit('onSuccess')
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    async productData(){
+      const res = await this.$api.requested(this.productParam)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.productParam.content.pageSize = val
+      this.productData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.productParam.content.pageNumber = val
+      this.productData()
+    },
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).productTable.tablecols
   }
 }
 </script>

+ 283 - 0
src/WebsiteManagement/caseManage/modules/edit.vue

@@ -0,0 +1,283 @@
+<template>
+  <div>
+    <el-button size="small" :type="disabled?'':'primary'" @click="editBtn(dialogFormVisible = true)" :disabled="disabled">编 辑</el-button>
+    <el-drawer
+        title="编辑案例"
+        :visible.sync="dialogFormVisible"
+        size="60%"
+        direction="rtl"
+        append-to-body
+        :show-close="false"
+        @close="onCancel">
+      <div class="drawer__panel" >
+        <el-row :gutter="10">
+          <el-form :model="form" :rules="rules" ref="form"  size="mini" label-position="top">
+            <el-col :span="24">
+              <el-form-item label="标题" prop="title">
+                <el-input v-model="form.title" placeholder="请输入标题"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="状态" prop="status">
+                <el-radio-group v-model="form.status" >
+                  <el-radio label="新建">新建</el-radio>
+                  <el-radio label="发布">发布</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="排序" prop="sequence">
+                <el-input v-model="form.sequence" placeholder="请输入排序"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="封面" prop="cover">
+                <previewImage v-if="form.cover" style="width:256px" :image="form.image" :deletebtn="true"
+                              @onSuccess="clearCover"></previewImage>
+                <upload v-else btntype="image" :folderid="folderid" accept=".JPG,.PNG"
+                        :bindData="{ ownertable: 'sat_sharematerial', ownerid: form.sat_sharematerialid, usetype: 'cover' }"
+                        @onSuccess="onCoverSubmit"></upload>
+                <p class="info">注:建议上传图片大小130x80像素,大小不超过2M,格式为JPG/PNG</p>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="内容" prop="notes">
+                <myEditor ref="editor" :content="form.content" :id="form.sat_sharematerialid"></myEditor>
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </el-row>
+        <div>
+          <div style="font-size: 16px;font-weight: bold;margin-bottom: 10px">关联产品</div>
+          <addProduct :sat_sharematerialid="form.sat_sharematerialid" style="margin-bottom: 10px" @selectData="selectData"></addProduct>
+          <tableNewLayout ref="tableRef" :checkbox="false" :custom="true" :data="list" :layout="tablecols"
+                          :opwidth="200" :width="true" height="300px">
+            <template v-slot:customcol="scope">
+              <div v-if="scope.column.columnname === 'itemclassfullname'">
+                {{scope.column.data.itemclass?scope.column.data.itemclass.length>0?scope.column.data.itemclass[0].itemclassfullname:'':''}}
+              </div>
+              <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+            </template>
+            <template v-slot:opreation="scope">
+              <el-button type="text" @click="delClick(scope.data)">删除</el-button>
+            </template>
+          </tableNewLayout>
+          <div  class="container normal-panel" style="text-align:right">
+            <el-pagination
+                background
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                :page-sizes="[20, 50, 100, 200]"
+                :page-size="20"
+                layout="total,sizes, prev, pager, next, jumper"
+                :total="total">
+            </el-pagination>
+          </div>
+        </div>
+      </div>
+      <div class="fixed__btn__panel">
+        <el-button size="small" type="primary" @click="onCancel" plain class="normal-btn-width" >取 消</el-button>
+        <el-button size="small"  @click="onSubmit" class="normal-btn-width">确 定</el-button>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import upload from '@/components/upload/hw_obs_upload.vue'
+import previewImage from '@/components/previewImage/index.vue'
+import myEditor from '@/components/my-editor/Editor.vue'
+import tableNewLayout from '@/components/dynamic-newTable/index2'
+import addProduct from '@/WebsiteManagement/caseManage/modules/addProduct'
+export default {
+  name: "edit",
+  components:{upload,previewImage,myEditor,tableNewLayout,addProduct},
+  props:['sat_sharematerialid','disabled'],
+  data(){
+    return {
+      dialogFormVisible:false,
+      tablecols:[],
+      list:[],
+      currentPage:0,
+      total:0,
+      form:{
+        "title": "",
+        "notes": "",
+        "content": "",
+        "sat_sharematerialid":0,
+        "status":"新建",
+        "sequence":'',
+        "image":'',
+        "cover":''
+      },
+      rules:{
+        title: [
+          { required: true, message: '请输入标题名称', trigger: 'blur' },
+        ],
+        cover: [
+          { required: true, message: '请上传封面', trigger: 'change' }
+        ],
+      },
+      folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
+      attinfo_attachment:[],
+      productParam:{
+        "id": "20240801134003",
+        "content": {
+          "sat_sharematerialid": '',
+          "pageNumber":1,
+          "pageSize":20,
+          "where": {
+            "condition": ""
+          }
+
+        }
+      }
+    }
+  },
+  methods:{
+    editBtn(){
+      this.detailInfo()
+    },
+    async detailInfo(){
+      const res = await this.$api.requested({
+        "id":20240801133703,
+        "content": {
+          "sat_sharematerialid":this.sat_sharematerialid
+        }
+      })
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }else {
+        this.form = Object.assign({},this.form,res.data)
+        this.$refs.editor.html = res.data.content
+        this.queryFileLink()
+        this.productParam.content.sat_sharematerialid = res.data.sat_sharematerialid
+        this.productData(this.productParam.content.pageNumber = 1)
+      }
+    },
+    // 获取封面信息
+    async queryFileLink() {
+      this.dialogEditVisible = true
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sat_sharematerial',
+          "ownerid": this.form.sat_sharematerialid,
+          "usetype": 'cover'//传空返回有所
+        }
+      })
+      this.form.image = res.data[0]
+      this.form.cover = res.data[0].url
+      /*res.data[0] ? this.image = res.data[0].url : this.image = { url: '' }*/
+    },
+    onSubmit(){
+      this.$refs.form.validate(async (valid)=>{
+        if (!valid) return false
+        this.form.content = this.$refs.editor.html
+        const res = await this.$api.requested({
+          "id": "20240801133403",
+          "content": this.form
+        })
+        this.tool.showMessage(res,()=>{
+          this.dialogFormVisible = false
+          this.$refs.form.resetFields()
+          this.$refs.editor.html = ''
+          this.form.image = ''
+          this.form.cover = ''
+          this.form.sat_sharematerialid = 0
+          this.$emit('editSuccess')
+        })
+      })
+    },
+    async onCancel(){
+      this.dialogFormVisible = false
+      this.$refs.form.resetFields()
+      this.$refs.editor.html = ''
+      this.form.image = ''
+      this.form.cover = ''
+      this.form.sat_sharematerialid = 0
+      this.$emit('onSuccess')
+    },
+    clearCover() {
+      this.form.cover = null
+      this.image = {}
+    },
+    async productData(){
+      const res = await this.$api.requested(this.productParam)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    async onCoverSubmit(data) {
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sat_sharematerial',
+          "ownerid": this.form.sat_sharematerialid,
+          "usetype": 'cover'//传空返回有所
+        }
+      })
+      this.form.cover = res.data[0].url
+      this.form.image = res.data[0]
+    },
+    async selectData(data){
+      const res = await this.$api.requested({
+        "id": "20240801133803",
+        "content": {
+          "sat_sharematerialid": this.form.sat_sharematerialid,
+          "sat_sharematerial_itemsid": data.sat_sharematerial_itemsid,
+          "itemid": data.itemid
+
+        }
+      })
+      this.productParam.content.sat_sharematerialid = this.form.sat_sharematerialid
+      this.productData()
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.productParam.content.pageSize = val
+      this.productData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.productParam.content.pageNumber = val
+      this.productData()
+    },
+    delClick(data){
+      this.$confirm('确定删除该商品吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then( () => {
+        this.delSuccess(data)
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    async delSuccess(data){
+      const res = await this.$api.requested({
+        "id":20240801133903,
+        "content": {
+          "sat_sharematerial_itemsid":data.sat_sharematerial_itemsid
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData()
+      })
+    }
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).productTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+
+</style>