zjf
2023-03-08 92b359a6458fb985b78431e0a2f54b548e01b1ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<template>
  <div>
    <c-r-m-list-head
      ref="listHead"
      title="报价/标书管理"
      main-title="人事管理"/>
      <c-r-m-table-head
        ref="crmTableHead"
        :crm-type="crmType"
        :fieldList='fieldList'
        @filter="handleFilter"
        @handle="handleHandle"
        @on-handle="listHeadHandle"
        @scene="handleScene"
        @queryList='queryList'/>
      <el-card class="el-card">
        <el-table
          v-loading="loading"
          id="crm-table"
          :data="list"
          :height="tableHeight"
          :cell-style="cellStyle"
          class="n-table--border"
          border
          highlight-current-row
          style="width: 100%"
          @row-click="handleRowClick"
          @sort-change="sortChange"
          @header-dragend="handleHeaderDragend"
          @selection-change="handleSelectionChange">
          <!--<el-table-column
            show-overflow-tooltip
            type="selection"
            align="left"
            width="55"/>-->
          <el-table-column
            v-for="(item, index) in fieldList"
            :key="index"
            :prop="item.field"
            :label="item.value"
            :width="item.width"
            :formatter="fieldFormatter"
            sortable="custom"
            show-overflow-tooltip>
            <template
              slot="header"
              slot-scope="scope">
              <div class="table-head-name">
                  {{ scope.column.label }}
                  <c-r-m-table-filter
                    :show="scope.column.label==='合同类型'"
                    :tableType="scope.column.label"
                    @queryList="queryList">
                  </c-r-m-table-filter>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="BeforeSealFile" label="盖章前文件">
            <template
              slot="header"
              slot-scope="scope">
              <div class="table-head-name">{{ scope.column.label }}</div>
            </template>
            <template slot-scope="scope">
              <span>{{scope.row.BeforeSealFile===''?'--':'点击下载'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="SealFile" label="盖章后文件">
            <template
              slot="header"
              slot-scope="scope">
              <div class="table-head-name">{{ scope.column.label }}</div>
            </template>
            <template slot-scope="scope">
              <span>{{scope.row.SealFile===''?'--':'点击下载'}}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="operation"
            width="150">
            <template
              slot="header"
              slot-scope="scope">
              <div class="table-head-name">操作</div>
            </template>
            <template slot-scope="scope">
            <el-button type="text" size="small"  @click='editList(scope.row)'>上传报价单</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="p-contianer"  v-show='total>0'>
          <el-pagination
            :current-page="currentPage"
            :page-sizes="pageSizes"
            :page-size.sync="pageSize"
            :total="total"
            class="p-bar"
            layout="total, sizes, prev, pager, next, jumper"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"/>
        </div>
      </el-card>
    <el-dialog title="上传盖章报价单" :visible.sync="isCreate" :modal-append-to-body="false" width="30%">
      <c-r-m-create-file-view
        v-if="isCreate"
        :id="rowID"
        :action="createActionInfo"
        crm-type="sealOffers"
        @save-success="createSaveSuccess"
        @hiden-view="isCreate=false"/>
    </el-dialog>
    <!-- 相关详情页面 -->
    <c-r-m-all-detail
      :visible.sync="showDview"
      :crm-type="rowType"
      :id="rowID"
      class="d-view"
      @handle="handleHandle"/>
    <fields-set
      :crm-type="crmType"
      :dialog-visible.sync="showFieldSet"
      @set-success="setSave"/>
  </div>
</template>
 
<script>
import CRMAllDetail from '@/views/clients/components/CRMAllDetail'
import table from '../mixins/table'
import CRMTableFilter from '../components/CRMTableFilter'
import CRMCreateFileView from '@/views/clients/components/CRMCreateFileView'
import { DeleteQuotationSheet } from '@/api/customermanagement/offer'
 
export default {
  /** 客户管理 的 合同列表 */
  name: 'SealOfferIndex',
  components: {
    CRMAllDetail,
    CRMTableFilter,
    CRMCreateFileView
  },
  mixins: [table],
  data () {
    return {
      crmType: 'sealOffers',
      isCreate: false,
      // 创建的相关信息
      createActionInfo: { type: 'update', crmType: 'sealOffers', data: {} },
      fieldList: [],
      moneyData: null // 合同列表金额
    }
  },
  computed: {
    moneyPageData () {
      // 未勾选展示合同总金额信息
      if (this.selectionList.length === 0 && this.moneyData) {
        return this.moneyData
      } else {
        let contractMoney = 0.0
        let receivedMoney = 0.0
        for (let index = 0; index < this.selectionList.length; index++) {
          const element = this.selectionList[index]
          // 2 审核通过的合同
          if (element.checkStatus === 1) {
            contractMoney += parseFloat(element.money)
            receivedMoney += parseFloat(element.receivedMoney)
          }
        }
        return {
          contractMoney: contractMoney.toFixed(2),
          receivedMoney: receivedMoney.toFixed(2)
        }
      }
    }
  },
  created () {
    this.getFieldList()
  },
  methods: {
    getFieldList () {
      this.fieldList.push(
        { field: 'QuotationNumber', value: '报价单编号' },
        { field: 'QuotationName', value: '报价单名称' },
        { field: 'CustomerName', value: '客户名称' },
        { field: 'SalesChanceName', value: '商机名称' },
        // { field: 'AuditStatus', value: '是否审批' },
        { field: 'AuditUserName', value: '审批人' },
        { field: 'IsSeal', value: '是否盖章' },
        { field: 'SealUserName', value: '盖章上传人' },
        { field: 'CreateTime', value: '创建时间' },
        { field: 'Comment', value: '备注' }
        // { field: 'BeforeSealFile', value: '盖章前文件' },
        // { field: 'SealFile', value: '盖章后文件' }
      )
    },
    queryList (data) {
      this.getList(data)
    },
    /** 编辑 */
    editList (row) {
      this.createActionInfo.data = row
      this.isCreate = true
    },
    deleteModule (id) {
      this.$confirm('确定删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          DeleteQuotationSheet([{'Id': id}]).then(res => {
            if (res.data.ErrorCode === 200) {
              this.$message.success(res.data.Message)
              this.getList()
            } else {
              this.$message.error(res.data.Message)
            }
          })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
    },
    createSaveSuccess () {
      this.getList()
      this.isCreate = false
    },
    /** 通过回调控制style */
    cellStyle ({ row, column, rowIndex, columnIndex }) {
      if (column.property === 'BeforeSealFile' || column.property === 'SealFile' || column.property === 'SalesChanceName' ||
        column.property === 'CustomerName') {
        return { color: '#4D88FF', cursor: 'pointer' }
      } else if (column.property === 'AuditStatus') {
        if (row[column.property] === '审批中') {
          return { color: '#FF8800' }
        } else if (row[column.property] === '通过') {
          return { color: '#2DB300' }
        } else if (row[column.property] === '驳回') {
          return { color: '#FF4D4D' }
        }
      } else {
        return { textAlign: 'left' }
      }
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '../styles/table.scss';
.money-bar {
  color: #99a9bf;
  line-height: 44px !important;
  position: absolute;
  left: 20px;
  top: 0;
}
</style>