123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <div>
- <!--模板头部-->
- <div class="container normal-panel" style="margin-top:16px" v-if="$route.query.type == 'panel'">
- <p class="normal-title normal-margin">模板信息</p>
- <el-descriptions :column="3" v-if="detail">
- <el-descriptions-item label="模板编号">{{detail.billnum?detail.billnum:'未知'}}</el-descriptions-item>
- <el-descriptions-item label="提报要求">
- <span v-if="detail.baseonproject == '1'">按项目及产品类别预测</span>
- <span v-else>按产品类别预测</span>
- </el-descriptions-item>
- <el-descriptions-item label="提报周期">{{detail.periodpoint | timer(detail.periodtype)}}</el-descriptions-item>
- <el-descriptions-item label="模板名称">{{detail.title?detail.title:'未知'}}</el-descriptions-item>
- <el-descriptions-item label="提报有效期">{{detail.begdate}}至{{detail.enddate}}</el-descriptions-item>
- <el-descriptions-item label="备注">暂无</el-descriptions-item>
- </el-descriptions>
- </div>
- <!--提报头部-->
- <div class="container normal-panel" style="margin-top:16px" v-else>
- <p class="normal-title normal-margin">基础信息</p>
- <el-descriptions :column="3" v-if="detail">
- <el-descriptions-item label="单号">{{detail.billnum?detail.billnum:'未知'}}</el-descriptions-item>
- <el-descriptions-item label="预测模板">{{detail.title?detail.title:'未知'}}</el-descriptions-item>
- <el-descriptions-item label="提报周期">{{detail.periodpoint | timer(detail.periodtype)}}</el-descriptions-item>
- <el-descriptions-item label="提报要求">
- <span v-if="detail.baseonproject == '1'">按项目及产品类别预测</span>
- <span v-else>按产品类别预测</span>
- </el-descriptions-item>
- <el-descriptions-item label="提报人">{{detail.createby}}</el-descriptions-item>
- <el-descriptions-item label="部门">{{detail.depname}}</el-descriptions-item>
- <el-descriptions-item label="职位">{{detail.position}}</el-descriptions-item>
- <el-descriptions-item label="提报时间">{{detail.createdate}}</el-descriptions-item>
- </el-descriptions>
- </div>
- <div class="container normal-panel" style="margin-top:16px">
- <p class="normal-title normal-margin">提报内容</p>
- <div class="handle">
- <div class="left">
- <Search />
- <DownSelect title="提报要求:" :list="[{value:'按产品类别'},{value:'按产品类别 + 项目'}]" style="margin-right:16px" />
- </div>
- <div class="right">
- <add-project @addSuccess="getSubmitList" />
- </div>
- </div>
- </div>
- <merge-table v-if="list" :layout="tablecols" :custom="true" :data1="list" :endFalse="true">
- <template v-slot:customcol="scope">
- <span v-if="scope.column.data[scope.column.columnname]">{{scope.column.data[scope.column.columnname]}}</span>
- <span v-if="!scope.column.data[scope.column.columnname] && scope.column.columnname != 'product_handle' && scope.column.columnname != 'project_handle'">-</span>
- </template>
- <template v-slot:product_handle="scope">
- <div style="display:flex">
- <edit :editData="scope.data" :tablecols="addProductTablecols" @editSuccess="getSubmitList" />
- <delete :rowData="scope.data" :projectid="0" @deleteSuccess="getSubmitList"/>
- </div>
- </template>
- <template v-slot:project_handle="scope">
- <div style="display:flex">
- <add-product :data1="scope" :productList="productList" :tablecols="addProductTablecols" @addSuccess="getSubmitList" />
- <delete :rowData="scope.data" :projectid="scope.data.sa_projectid" @deleteSuccess="getSubmitList" />
- </div>
- </template>
- </merge-table>
- </div>
- </template>
- <script>
- import Search from '@/components/search/index'
- import DownSelect from '@/components/down_select/index'
- import addProject from '../components/addProject'
- import mergeTable from '../components/mergeTable'
- import edit from '../components/edit'
- import Delete from '../components/delete'
- import addProduct from '../components/addProduct'
- export default {
- name: '',
- data() {
- return {
- id:this.$route.query.id,
- detail:'',
- list:'',
- tablecols:'',
- /* 添加产品表格 */
- addProductTablecols:'',
- productList:''
- };
- },
- components:{Search, DownSelect , addProject , mergeTable , edit , Delete , addProduct},
- computed:{
- },
- watch:{
- },
- filters: {
- timer (val, type) {
- if (type == '月') {
- return '每月' + val.substr(1, val.length - 2) + '日'
- } else {
- return '每周' + val.substr(1, val.length - 2)
- }
- }
- },
- created() {
- this.getHeaderDetail()
- this.getProductList()
- this.tablecols = this.tool.tabelCol(this.$route.name).salesEditTable.tablecols
- this.addProductTablecols = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
- console.log(this.addProductTablecols);
-
- },
- methods: {
- /* 获取详情表头数据 */
- async getHeaderDetail() {
- let res
- if(this.$route.query.type == 'panel') {
- res = await this.$api.requested({
- "id": 20220906154603,
- "version":1,
- "content": {
- "sa_salesforecastmodelid":this.$route.query.id2
- }
- })
- this.detail = res.data
- } else {
- res = await this.$api.requested({
- "id": 20220914104603,
- "version":1,
- "content": {
- "sa_salesforecastbillid":this.id
- }
- })
- this.detail = res.data[0]
- }
- this.getSubmitList()
- console.log(this.detail);
- },
- /* 获取详情提报内容数据 */
- async getSubmitList() {
- let res = await this.$api.requested({
- "id": 20220906154703,
- "version":1,
- "content": {
- "nocache":true,
- "sa_salesforecastbillid":this.id,
- "where":{
- "condition":""
- }
- }
- })
- console.log(res.data);
-
- res.data[0].sa_projectid ? this.list = res.data : this.list = []
- },
- /* 获取所有产品数据 */
- async getProductList() {
- let res = await this.$api.requested({
- "id": 20220906154903,
- "version":1,
- "content": {
- }
- })
- this.productList = res.data
- console.log(this.productList);
-
- }
- },
- };
- </script>
- <style scoped>
- .handle {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .handle .left {
- display: flex;
- align-items: center;
- }
- </style>
|