123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <div>
- <div class="flex-align-center flex-between mt-10">
- <el-input style="width:200px" prefix-icon="el-icon-search" size="small" placeholder="搜索项目名称" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" clearable></el-input>
- <addProject v-if="checkDateOut && tool.checkAuth($route.name,'projectProductListManage')" :mainData="mainData" @onSuccess="listData(param.content.pageNumber = 1)"></addProject>
- </div>
- <el-table
- :data="list"
- style="width: 100%"
- size="mini"
- border
- @row-click="rowClick">
- <el-table-column
- prop="projectnum"
- label="项目编号">
- </el-table-column>
- <el-table-column
- prop="projectname"
- label="项目名称">
- </el-table-column>
- <el-table-column
- prop="projecttype"
- label="项目类型">
- </el-table-column>
- <el-table-column
- prop="sumprojectamount"
- label="金额">
- </el-table-column>
- <el-table-column
- label="操作"
- width="150">
- <template slot-scope="scope">
- <addProduct v-if="checkDateOut && tool.checkAuth($route.name,'projectProductListManage')" class="inline-16" :id="scope.row.sa_projectid" :mainData="mainData" @onSuccess="rowClick(act_row)"></addProduct>
- <el-button size="small" type="text" :disabled="!checkDateOut" @click="deleteProject(scope.row)">删 除{{scope.row.sa_salesforecastid}}</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="container normal-panel flex-align-center flex-between">
- <p v-if="list[0]">金额合计:{{list[0].sumamount}}</p>
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[20, 50, 100, 200]"
- layout="total,sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </template>
- <script>
- import addProject from '@/template/salesForecastUseProject/index.vue'
- import addProduct from '@/template/salesForecastUseProject/addProduct.vue'
- export default {
- props:['mainData'],
- components:{
- addProject,
- addProduct
- },
- data () {
- return {
- param:{
- "id": 20220916115203,
- "content": {
- "pageNumber":1,
- "pageSize":20,
- "sa_salesforecastbillid":this.$route.query.id,
- "where":{
- "condition":""
- }
- }
- },
- act_row:{},
- list:[],
- currentPage:0,
- total:0,
- checkDateOut:false,
- }
- },
- methods:{
- async listData () {
- console.log(this.$route.query.id)
- const res = await this.$api.requested(this.param)
- this.list = res.data
- this.total = res.total
- this.currentPage = res.pageNumber
- console.log(res,"项目")
- this.$emit('queryProduct',res.data[0].sa_projectid)
- },
- async deleteProject (row) {
- const res = await this.$api.requested({
- "id": 20220906155103,
- "version":1,
- "content": {
- "sa_salesforecastid":0,
- "sa_projectid":row.sa_projectid,
- "sa_salesforecastbillid":this.$route.query.id
- }
- })
- this.tool.showMessage(res,()=>{
- this.listData()
- })
- },
- handleSizeChange(val) {
- // console.log(`每页 ${val} 条`);
- this.param.content.pageSize = val
- this.listData()
- },
- handleCurrentChange(val) {
- // console.log(`当前页: ${val}`);
- this.param.content.pageNumber = val
- this.listData()
- },
- rowClick (row) {
- this.act_row = row
- this.$emit('queryProduct',row.sa_projectid)
- }
- },
- watch:{
- mainData (val) {
- let date = new Date(this.mainData.periodend)
- let now = Date.now()
- if (date.getTime() < now) {
- console.log('已过期')
- this.checkDateOut = false
- } else {
- console.log('未过期')
- this.checkDateOut = true
- }
- }
- },
- mounted () {
- this.listData()
- }
- }
- </script>
- <style>
- </style>
|