|
@@ -127,35 +127,35 @@
|
|
|
<tr>
|
|
|
<td class="title">项目<br />虚拟结算额</td>
|
|
|
<td class="content" colspan="3">
|
|
|
- <div style="display: flex; align-items: flex-end">
|
|
|
- <table>
|
|
|
- <thead>
|
|
|
- <td>序号</td>
|
|
|
- <td>试验设备</td>
|
|
|
- <td>试验时间(h)</td>
|
|
|
- <td>试验单价(rmb/h)</td>
|
|
|
- <td>试验费用</td>
|
|
|
- <td style="width: 60px">操作</td>
|
|
|
- </thead>
|
|
|
- <tr v-for="(item, index) in tableData.cleanPrice" :key="index">
|
|
|
- <td>{{ index + 1 }}</td>
|
|
|
- <td><input style="max-width: 150px; text-align: center" v-model="item.shebei" /></td>
|
|
|
- <td><input style="max-width: 150px; text-align: center" v-model="item.time" /></td>
|
|
|
- <td><input style="max-width: 150px; text-align: center" v-model="item.price" /></td>
|
|
|
- <td>{{ item.time * item.price }}</td>
|
|
|
- <td><div class="delBtn" @click="delRow(index)" v-show="tableData.cleanPrice.length >= 2">删除</div></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td style="font-weight: bold;">合计</td>
|
|
|
- <td></td>
|
|
|
- <td></td>
|
|
|
- <td></td>
|
|
|
- <td style="font-weight: bold;">{{ totalCleanPrice }}</td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- <div class="addRow" style="margin-right:1.1%" @click="addRow">添加</div>
|
|
|
- <!-- <div class="addRow" @click="addSubTable">提交</div> -->
|
|
|
- </div>
|
|
|
+ <el-table :data="tableData.xnJiesuanPrice" class="u-dynamic-table" stripe show-summary :summary-method="getSummaries" border ref="table">
|
|
|
+ <el-table-column type="index" label="序号" align="center" width="60"></el-table-column>
|
|
|
+ <el-table-column prop="eqName" label="试验设备" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-select v-model="scope.row.eqName" placeholder="请选择" value-key="id" @change="chooseEquipment($event, scope.$index)" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in equipmentOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.deviceName"
|
|
|
+ :value="item">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="typeName" label="试验类型" align="center" width="120"></el-table-column>
|
|
|
+ <el-table-column prop="time" label="试验时间(h)" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.time" placeholder="请输入" @input="handleCheng(scope.row, scope.$index)"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="unitPrice" label="试验单价(rmb/h)" align="center" width="140"></el-table-column>
|
|
|
+ <el-table-column prop="costPrice" label="试验费用" align="center" width="100"></el-table-column>
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="small" @click="handleDelete(scope.row, scope.$index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="addRow" @click="addRow">添加</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -191,172 +191,29 @@
|
|
|
import '@/assets/less/TableExpand.less'
|
|
|
import { mixinDevice } from '@/utils/mixin'
|
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
|
+import { getDeviceList } from '@/api/api'
|
|
|
|
|
|
export default {
|
|
|
name: 'itdmXmShuru',
|
|
|
mixins: [JeecgListMixin, mixinDevice],
|
|
|
data() {
|
|
|
return {
|
|
|
- description: '试验项目输入管理页面',
|
|
|
tableData: {
|
|
|
- cleanPrice: [
|
|
|
- {
|
|
|
- total: 0,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- // 表头
|
|
|
- columns: [
|
|
|
- {
|
|
|
- title: '#',
|
|
|
- dataIndex: '',
|
|
|
- key: 'rowIndex',
|
|
|
- width: 60,
|
|
|
- align: 'center',
|
|
|
- customRender: function (t, r, index) {
|
|
|
- return parseInt(index) + 1
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- title: '是否新客户',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'newkehu',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '客户行业',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'kehuHangye',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '客户名称',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'kehuMingcheng',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '输入类型',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'shuruLeixing',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '试验信息',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'shiyanXinxi',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '方案设计',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'fanganSheji_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '试验评审',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'shiyanPingshen_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '用车安排',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'yongcheAnpai_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '工装设计',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'gongzhuangSheji_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '用餐安排',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'yongcanAnpai_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '住宿安排',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'zhusuAnpai_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '报告确认',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'baogaoQueren_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '客户姓名',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'kehuName',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '客户电话',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'kehuPhone',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '合同编号',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'hetongBianhao',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '试验要求',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'shiyanYaoqiu',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '报告体系',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'baogaoTixi_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '资质要求',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'zizhiYaoqiu_dictText',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '预计报价',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'yujiBaojia',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '评审结论',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'pingshenJielun',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '主审人',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'zhushenRen',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '主审时间',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'zhushenShijian',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- dataIndex: 'action',
|
|
|
- align: 'center',
|
|
|
- fixed: 'right',
|
|
|
- width: 147,
|
|
|
- scopedSlots: { customRender: 'action' },
|
|
|
- },
|
|
|
- ],
|
|
|
- url: {
|
|
|
- list: '/itdmShiYanXiangMu/itdmShiyanxiangmu/list',
|
|
|
- delete: '/itdmShiYanXiangMu/itdmShiyanxiangmu/delete',
|
|
|
- deleteBatch: '/itdmShiYanXiangMu/itdmShiyanxiangmu/deleteBatch',
|
|
|
- exportXlsUrl: '/itdmShiYanXiangMu/itdmShiyanxiangmu/exportXls',
|
|
|
- importExcelUrl: 'itdmShiYanXiangMu/itdmShiyanxiangmu/importExcel',
|
|
|
+ xnJiesuanPrice: [{}],
|
|
|
},
|
|
|
- dictOptions: {},
|
|
|
- superFieldList: [],
|
|
|
+ equipmentOptions: [],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getSuperFieldList()
|
|
|
+ this.getDevicePrice()
|
|
|
},
|
|
|
computed: {
|
|
|
importExcelUrl: function () {
|
|
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
|
|
|
},
|
|
|
- totalCleanPrice() {
|
|
|
+ totalPrice() {
|
|
|
let total = 0
|
|
|
- this.tableData.cleanPrice.forEach((item) => {
|
|
|
+ this.tableData.xnJiesuanPrice.forEach((item) => {
|
|
|
var row = item.time * item.price
|
|
|
if (!isNaN(row)) {
|
|
|
total += Number(row)
|
|
@@ -366,6 +223,66 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ getDevicePrice(){
|
|
|
+ getDeviceList().then(response => {
|
|
|
+ console.log(response)
|
|
|
+ this.equipmentOptions = response
|
|
|
+ })
|
|
|
+ },
|
|
|
+ chooseEquipment(value, index){
|
|
|
+ var row = this.tableData.xnJiesuanPrice[index]
|
|
|
+ this.tableData.xnJiesuanPrice[index].type = value.zyxbz
|
|
|
+ this.tableData.xnJiesuanPrice[index].typeName = value.zyxbzText
|
|
|
+ this.tableData.xnJiesuanPrice[index].unitPrice = value.danjia
|
|
|
+ this.tableData.xnJiesuanPrice[index].costPrice = row.unitPrice * row.time || 0
|
|
|
+ },
|
|
|
+ handleCheng(value, index){
|
|
|
+ console.log(value)
|
|
|
+ // console.log(this.$refs.table.summaryMethod())
|
|
|
+ this.tableData.xnJiesuanPrice[index].costPrice = value.unitPrice * value.time || 0
|
|
|
+ },
|
|
|
+ getSummaries(param){
|
|
|
+ const { columns, data } = param;
|
|
|
+ console.log(columns, data)
|
|
|
+ const len = columns.length;
|
|
|
+ const sums = [];
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ // 第一列显示合计
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '合计';
|
|
|
+ return;
|
|
|
+ }else if(index === len - 2){ // 返回数据长度的最后一个
|
|
|
+ const times = data.map(item => Number(item['time']));
|
|
|
+ const prices = data.map(item=>Number(item['unitPrice']))
|
|
|
+ const eqName = data.map(item => item['eqName']); // 谁改变也要写在这,要不不能触发
|
|
|
+ // if (!times.every(value => isNaN(value))) {
|
|
|
+ //通过reduce求和,curr为每一列的每个元素的值,return prev返回值给到sums[index]
|
|
|
+ sums[index] = times.reduce((prev, curr, index) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ //确定数据是否为空,不为空进行计算,为空返回原值
|
|
|
+ if (!isNaN(value) && !isNaN(prices[index])) {
|
|
|
+ //curr为工时,prices为单价,求得每行的金额,再通过reduce累加求和
|
|
|
+ console.log(curr*prices[index], prev + curr*prices[index])
|
|
|
+ return prev + curr*prices[index];
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ // } else {
|
|
|
+ // sums[index] = 0;
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return sums;
|
|
|
+ },
|
|
|
+ handleDelete(row, index){
|
|
|
+ this.tableData.xnJiesuanPrice.splice(index, 1)
|
|
|
+ },
|
|
|
+ addRow() {
|
|
|
+ this.tableData.xnJiesuanPrice.push({})
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
submit() {
|
|
|
|
|
|
let zizhiYaoqiu = []
|
|
@@ -391,39 +308,6 @@ export default {
|
|
|
console.log(this.tableData.cleanPrice)
|
|
|
console.log(this.tableData)
|
|
|
},
|
|
|
- addRow() {
|
|
|
- this.tableData.cleanPrice.push({})
|
|
|
- },
|
|
|
- delRow(index) {
|
|
|
- this.tableData.cleanPrice.splice(index, 1)
|
|
|
- },
|
|
|
- initDictConfig() {},
|
|
|
- getSuperFieldList() {
|
|
|
- let fieldList = []
|
|
|
- fieldList.push({ type: 'string', value: 'newkehu', text: '是否新客户', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'kehuHangye', text: '客户行业', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'kehuMingcheng', text: '客户名称', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'shuruLeixing', text: '输入类型', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'shiyanXinxi', text: '试验信息', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'fanganSheji', text: '方案设计', dictCode: 'fangan_sheji' })
|
|
|
- fieldList.push({ type: 'string', value: 'shiyanPingshen', text: '试验评审', dictCode: 'shiyan_pingshen' })
|
|
|
- fieldList.push({ type: 'string', value: 'yongcheAnpai', text: '用车安排', dictCode: 'yongche_anpai' })
|
|
|
- fieldList.push({ type: 'string', value: 'gongzhuangSheji', text: '工装设计', dictCode: 'gongzhuang_sheji' })
|
|
|
- fieldList.push({ type: 'string', value: 'yongcanAnpai', text: '用餐安排', dictCode: 'yongcan_anpai' })
|
|
|
- fieldList.push({ type: 'string', value: 'zhusuAnpai', text: '住宿安排', dictCode: 'zhusu_anpai' })
|
|
|
- fieldList.push({ type: 'string', value: 'baogaoQueren', text: '报告确认', dictCode: 'baogao_queren' })
|
|
|
- fieldList.push({ type: 'string', value: 'kehuName', text: '客户姓名', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'kehuPhone', text: '客户电话', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'hetongBianhao', text: '合同编号', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'shiyanYaoqiu', text: '试验要求', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'baogaoTixi', text: '报告体系', dictCode: 'baogao_tixi' })
|
|
|
- fieldList.push({ type: 'string', value: 'zizhiYaoqiu', text: '资质要求', dictCode: 'zizhi_yaoqiu' })
|
|
|
- fieldList.push({ type: 'string', value: 'yujiBaojia', text: '预计报价', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'pingshenJielun', text: '评审结论', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'zhushenRen', text: '主审人', dictCode: '' })
|
|
|
- fieldList.push({ type: 'string', value: 'zhushenShijian', text: '主审时间', dictCode: '' })
|
|
|
- this.superFieldList = fieldList
|
|
|
- },
|
|
|
},
|
|
|
}
|
|
|
</script>
|