qymljy 1 year ago
parent
commit
c41d80920f

+ 117 - 11
src/Form/caseManage/add.vue

@@ -9,7 +9,7 @@
         append-to-body
         :show-close="false"
         @close="onCancel">
-      <div class="drawer__panel" style="margin-bottom: 0!important;">
+      <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">
@@ -35,20 +35,30 @@
                 <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_notice', ownerid: form.sat_noticeid, usetype: 'cover' }"
+                        :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.notes" :id="form.sat_sharematerialid"></myEditor>
+                <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">关联产品</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>
+          </tableNewLayout>
         </div>
       </div>
       <div class="fixed__btn__panel">
@@ -63,18 +73,22 @@
 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: "add",
-  components:{upload,previewImage,myEditor},
+  components:{upload,previewImage,myEditor,tableNewLayout,addProduct},
   data(){
     return {
       dialogFormVisible:false,
+      tablecols:[],
+      list:[],
       form:{
         "title": "",
         "notes": "",
         "content": "",
         "sat_sharematerialid":0,
-        "status":"发布",
+        "status":"新建",
         "sequence":'',
         "image":{},
       },
@@ -88,16 +102,79 @@ export default {
       },
       folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
       attinfo_attachment:[],
+      productParam:{
+        "id": "20240801134003",
+        "content": {
+          "sat_sharematerialid": '',
+          "where": {
+            "condition": ""
+          }
+
+        }
+      }
     }
   },
   methods:{
-    addBtn(){},
-    onSubmit(){},
-    onCancel(){},
+    addBtn(){
+      this.createCase()
+    },
+    /*新建空的案例*/
+    async createCase(){
+      const res = await this.$api.requested({
+        "id": "20240801133403",
+        "content": {
+          "title": "",
+          "notes": "",
+          "content": "",
+          "sat_sharematerialid":0,
+          "status":"新建",
+          "sequence":''
+        }
+      })
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{
+        })
+      }else {
+        this.form.sat_sharematerialid = res.data.sat_sharematerialid
+        this.productParam.content.sat_sharematerialid = res.data.sat_sharematerialid
+        this.productData()
+      }
+    },
+    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.$emit('onSuccess')
+        })
+      })
+    },
+    async onCancel(){
+      this.dialogFormVisible = false
+      if (this.form.title == '' || this.form.image == {}){
+        const res = await this.$api.requested({
+          "id":20240801133503,
+          "content": {
+            "sat_sharematerialids":[this.form.sat_sharematerialid]
+          }
+        })
+      }
+    },
     clearCover() {
       this.form.cover = null
       this.image = {}
     },
+    async productData(){
+      const res = await this.$api.requested(this.productParam)
+      this.list = res.data
+    },
     async onCoverSubmit(data) {
       // console.log(res,'上传图片1111')
       // this.image = res.data.attachmentids[0]
@@ -105,8 +182,8 @@ export default {
         "classname": "system.attachment.Attachment",
         "method": "queryFileLink",
         "content": {
-          "ownertable": 'sat_notice',
-          "ownerid": this.form.sat_noticeid,
+          "ownertable": 'sat_sharematerial',
+          "ownerid": this.form.sat_sharematerialid,
           "usetype": 'cover'//传空返回有所
         }
       })
@@ -117,6 +194,35 @@ export default {
       // 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
+        }
+      })
+    },
+    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()
+    },
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).productTable.tablecols
   }
 }
 </script>

+ 6 - 1
src/WebsiteManagement/caseManage/index.vue

@@ -30,7 +30,7 @@
         </div>
       </template>
       <template v-slot:tbOpreation="scope">
-        <detailInfo :sat_noticeid="scope.data.data.sat_noticeid" @onSuccess="onSuccess"></detailInfo>
+        <detailInfo :data="scope.data.data" @onSuccess="onSuccess"></detailInfo>
       </template>
     </basicLayout>
   </div>
@@ -41,6 +41,11 @@ import detailInfo from "./modules/detailInfo"
 export default {
   name: "index",
   components:{detailInfo},
+  data(){
+    return {
+      status:""
+    }
+  },
   methods:{
     selectChange(){
       this.$refs.basicLayout.param.content.where.status = this.status

+ 113 - 0
src/WebsiteManagement/caseManage/modules/addProduct.vue

@@ -0,0 +1,113 @@
+<template>
+  <div>
+    <el-button  type="primary" size="small" @click="addBtn(drawer = true)">添加</el-button>
+    <el-drawer
+        title="添加商品"
+        :visible.sync="drawer"
+        direction="rtl"
+        size="60%"
+        append-to-body
+        :show-close="false"
+        @close="closeDrawer">
+      <div class="drawer__panel" style="margin-bottom: 0!important;">
+        <el-input  style="width:200px;margin-bottom: 10px" placeholder="搜索" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
+        </el-input>
+        <tableNewLayout  ref="tableRef" :checkbox="false" :custom="true" :data="list" :layout="tablecols"
+                        :opwidth="200" :width="true" height="calc(100vh - 200px)">
+          <template v-slot:customcol="scope">
+            <div v-if="scope.column.columnname === 'attinfos'">
+              <previewImage v-if="scope.column.data.attinfos[0]" class="image" :image="scope.column.data.attinfos[0]" :list="scope.column.data.attinfos" :deletebtn="false"></previewImage>
+            </div>
+            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+          </template>
+          <template v-slot:opreation="scope">
+            <el-button type="text" @click="selectClick(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="[50, 100, 150, 200]"
+              :page-size="50"
+              layout="total,sizes, prev, pager, next, jumper"
+              :total="total">
+          </el-pagination>
+        </div>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import tableNewLayout from '@/components/dynamic-newTable/index2'
+import previewImage from '@/components/previewImage/index'
+export default {
+  name: "addProduct",
+  components:{tableNewLayout,previewImage},
+  props:['sat_sharematerialid'],
+  data(){
+    return {
+      drawer:false,
+      tablecols:[],
+      list:[],
+      total:0,
+      currentPage:0,
+      param:{
+        "id": "20240801134103",
+        "content": {
+          "sat_sharematerialid": '',
+          "pageNumber": 1,
+          "pageSize": 50,
+          "where": {
+            "condition": ""
+          }
+
+        }
+      }
+    }
+  },
+  methods:{
+    addBtn(){
+      this.param.content.sat_sharematerialid = this.sat_sharematerialid
+      this.listData(this.param.content.pageNumber = 1)
+    },
+    async listData(){
+      const res = await this.$api.requested(this.param)
+      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)
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+    closeDrawer(){}
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+.image{
+  height: 38px;
+  width: 38px;
+  margin-top:0;
+}
+</style>

+ 48 - 2
src/WebsiteManagement/caseManage/modules/detailInfo.vue

@@ -1,10 +1,56 @@
 <template>
-  <div></div>
+  <div>
+    <el-button size="small" type="text" @click="detailBtn(dialogFormVisible = true)">详情</el-button>
+    <el-drawer
+        title="案例管理"
+        :visible.sync="dialogFormVisible"
+        size="60%"
+        direction="rtl"
+        append-to-body
+        :show-close="false"
+        :with-header="false"
+        @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>-->
+          <el-button v-if="tool.checkAuth($route.name,'delete')" :type="form.status == '发布'?'':'primary'" size="small" @click="delBtn" :disabled="form.status == '发布'">删除</el-button>
+        </div>
+      </div>
+    </el-drawer>
+  </div>
 </template>
 
 <script>
 export default {
-  name: "detailInfo"
+  name: "detailInfo",
+  props:['data'],
+  data(){
+    return {
+      dialogFormVisible:false,
+      form:{
+
+      }
+    }
+  },
+  methods:{
+    detailBtn(){},
+    onClose(){},
+    async delBtn(){
+      console.log(this.data,this.data.sat_sharematerialid)
+      const res = await this.$api.requested({
+        "id":20240801133503,
+        "content": {
+          "sat_sharematerialids":[this.data.sat_sharematerialid]
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.$emit('onSuccess')
+      })
+    }
+  }
 }
 </script>