123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <div>
- <el-button size="small" type="primary" icon="el-icon-plus" @click="onShow">添加商品</el-button>
- <el-drawer
- title="选择商品"
- :visible.sync="dialogProductVisible"
- append-to-body
- size="80%"
- direction="rtl"
- @close="onColes">
- <div class="drawer__panel">
- <div class="flex-align-center flex-between ">
- <slot name="operation"></slot>
- <div class="flex-align-center">
- <el-input size="small" suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="productData(params.content.pageNumber = 1)" @clear="productData(params.content.pageNumber = 1)" clearable></el-input>
- </div>
- </div>
- <div class="produtMag-panel">
- <el-table
- ref="multipleTable"
- :data="list"
- style="width: 100%"
- :header-cell-style="{height:'50px',color:'#768093',fontWeight:'100'}"
- :cell-style="{height:'50px',color:'#768093',fontWeight:'200'}"
- @selection-change="selectionChange">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- align="center"
- label="产品图"
- width="80">
- <template slot-scope="scope">
- <div v-if="scope.row.attinfos[0]">
- <previewImage class="image" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- prop="itemno"
- label="产品编号"
- width="180">
- </el-table-column>
- <el-table-column
- prop="itemname"
- label="产品名称"
- width="180">
- </el-table-column>
- <el-table-column
- label="型号/规格"
- width="180">
- <template slot-scope="scope">
- <p><span>{{scope.row.model}}</span> / <span>{{scope.row.spec}}</span></p>
- </template>
- </el-table-column>
- <el-table-column
- prop="caliber"
- label="口径"
- width="180">
- </el-table-column>
- <el-table-column
- prop="pressure"
- label="压力"
- width="180">
- </el-table-column>
- <el-table-column
- prop="material"
- label="材质"
- width="180">
- </el-table-column>
- <el-table-column
- prop="brand"
- label="品牌"
- width="180">
- <template slot-scope="scope">
- <p v-for="(item,index) in scope.row.brand">
- <span style="float: left" v-if="index === scope.row.brand.length -1">{{item?item.brandname+'':'--'}}</span>
- <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
- </p>
- </template>
- </el-table-column>
- <el-table-column
- prop="itemclass"
- label="类别"
- width="0">
- <template slot-scope="scope">
- <p v-for="(item,index) in scope.row.itemclass">
- <span style="float: left" v-if="index === scope.row.itemclass.length -1">{{item?item.itemclassname+'':'--'}}</span>
- <span style="float: left" v-else>{{item?item.itemclassname+',':'--'}}</span>
- </p>
- </template>
- </el-table-column>
- <el-table-column
- prop="unitid"
- label="计量单位"
- width="100">
- <template slot-scope="scope">
- <el-tag size="mini" type="info" effect="plain">{{scope.row.unitname}}/{{scope.row.axunitname}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column
- prop="marketprice"
- label="牌价"
- width="100">
- <template slot-scope="scope">
- <span >{{scope.row.marketprice?scope.row.marketprice+',':'--'}}</span>
- </template>
- </el-table-column>
- </el-table>
- <div style="margin-top:16px;text-align:right">
- <el-pagination
- background
- small
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="params.content.pageSize"
- layout="total, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </div>
- <div class="fixed__btn__panel">
- <el-button size="small" @click="onColes" class="normal-btn-width">取 消</el-button>
- <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
- </div>
- </el-drawer>
- </div>
- </template>
- <script>
- import uploadFile from "@/components/upload/hw_obs_upload";
- import previewImage from "@/components/previewImage";
- export default {
- name: "productTable",
- props:["id"],
- components:{uploadFile, previewImage},
- data(){
- return {
- dialogProductVisible:false,
- type:'',
- tablecols:[],
- list:[],
- total:0,
- currentPage:0,
- tableSelectData:[],
- selectData:[],
- sa_quotedpriceid:'',
- params:{
- "id": 20221020164903,
- "version":1,
- "content": {
- "sa_projectid":'',
- "sa_quotedpriceid":"",
- "pageNumber": 1,
- "pageSize": 20,
- "where": {
- "condition": ""
- }
- }
- }
- }
- },
- methods:{
- onShow(){
- /* this.dialogProjectVisible = true*/
- console.log(this.id,"项目编号")
- this.$emit('checkForm')
- /*this.productData()*/
- },
- onColes(){
- this.dialogProductVisible = false
- },
- async onSubmit(){
- const res = await this.$api.requested({
- "id": 20221021095403,
- "version":1,
- "content": {
- "sa_quotedpriceid":this.params.content.sa_quotedpriceid, //sat_notice_classid<=0时 为新增
- "items":this.selectData
- }
- })
- this.tool.showMessage(res,()=>{
- console.log(res)
- this.dialogProductVisible = false
- this.$emit('productAdd',this.params.content.sa_quotedpriceid)
- })
- },
- /*获取产品信息*/
- queryProduct(id,type){
- console.log(id,type)
- this.dialogProductVisible = true
- this.params.content.sa_projectid = this.id
- console.log(id,"报价单id五")
- this.type = type
- console.log(this.type)
- this.sa_quotedpriceid = id
- this.productData()
- },
- /*产品配置信息*/
- async productData(){
- console.log("执行")
- console.log(this.sa_quotedpriceid,"报价单id四")
- this.params.content.sa_quotedpriceid = this.sa_quotedpriceid
- const res = await this.$api.requested(this.params)
- this.list = res.data
- this.total = res.total
- console.log(res,'产品配置信息')
- console.log(this.type)
- this.$nextTick(()=>{
- console.log(this.type)
- if (this.type === '项目报价'){
- for (let i=0;i<this.list.length;i++){
- this.$refs.multipleTable.toggleRowSelection(this.list[i],true)
- }
- }
- })
- },
- handleSizeChange(val) {
- // console.log(`每页 ${val} 条`);
- this.param.content.pageSize = val
- this.productData()
- },
- handleCurrentChange(val) {
- // console.log(`当前页: ${val}`);
- this.param.content.pageNumber = val
- this.productData()
- },
- onSuccess(){
- this.productData()
- },
- clearData(){
- console.log("执行")
- this.search = ""
- this.param.content.where.condition = this.search
- this.productData()
- },
- queryClick(){
- this.param.content.where.condition = this.search
- this.productData()
- },
- selectionChange(val){
- console.log(val)
- this.tableSelectData = val
- if (this.type === '项目报价'){
- let obj = this.tableSelectData.map(e=>{
- return {
- sa_quotedprice_itemsid:'0',
- itemid:e.itemid,
- oldprice:e.marketprice,
- /*price:(e.marketprice * 100)/100,*/
- price:0,
- discountrate:0,
- qty:e.qty
- }
- })
- console.log(obj)
- this.selectData = obj
- }else {
- let obj = this.tableSelectData.map(e=>{
- return {
- sa_quotedprice_itemsid:'0',
- itemid:e.itemid,
- oldprice:e.marketprice,
- /*price:(e.marketprice * 100)/100,*/
- price:0,
- discountrate:0,
- qty:1
- }
- })
- console.log(obj)
- this.selectData = obj
- }
- }
- },
- mounted() {
- }
- }
- </script>
- <style scoped>
- .image {
- width:40px;height:40px;margin:0px auto;
- }
- </style>
|