editSales.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div>
  3. <!--模板头部-->
  4. <div class="container normal-panel" style="margin-top:16px" v-if="$route.query.type == 'panel'">
  5. <p class="normal-title normal-margin">模板信息</p>
  6. <el-descriptions :column="3" v-if="detail">
  7. <el-descriptions-item label="模板编号">{{detail.billnum?detail.billnum:'未知'}}</el-descriptions-item>
  8. <el-descriptions-item label="提报要求">
  9. <span v-if="detail.baseonproject == '1'">按项目及产品类别预测</span>
  10. <span v-else>按产品类别预测</span>
  11. </el-descriptions-item>
  12. <el-descriptions-item label="提报周期">{{detail.periodpoint | timer(detail.periodtype)}}</el-descriptions-item>
  13. <el-descriptions-item label="模板名称">{{detail.title?detail.title:'未知'}}</el-descriptions-item>
  14. <el-descriptions-item label="提报有效期">{{detail.begdate}}至{{detail.enddate}}</el-descriptions-item>
  15. <el-descriptions-item label="备注">暂无</el-descriptions-item>
  16. </el-descriptions>
  17. </div>
  18. <!--提报头部-->
  19. <div class="container normal-panel" style="margin-top:16px" v-else>
  20. <p class="normal-title normal-margin">基础信息</p>
  21. <el-descriptions :column="3" v-if="detail">
  22. <el-descriptions-item label="单号">{{detail.billnum?detail.billnum:'未知'}}</el-descriptions-item>
  23. <el-descriptions-item label="预测模板">{{detail.title?detail.title:'未知'}}</el-descriptions-item>
  24. <el-descriptions-item label="提报周期">{{detail.periodpoint | timer(detail.periodtype)}}</el-descriptions-item>
  25. <el-descriptions-item label="提报要求">
  26. <span v-if="detail.baseonproject == '1'">按项目及产品类别预测</span>
  27. <span v-else>按产品类别预测</span>
  28. </el-descriptions-item>
  29. <el-descriptions-item label="提报人">{{detail.createby}}</el-descriptions-item>
  30. <el-descriptions-item label="部门">{{detail.depname}}</el-descriptions-item>
  31. <el-descriptions-item label="职位">{{detail.position}}</el-descriptions-item>
  32. <el-descriptions-item label="提报时间">{{detail.createdate}}</el-descriptions-item>
  33. </el-descriptions>
  34. </div>
  35. <div class="container normal-panel" style="margin-top:16px">
  36. <p class="normal-title normal-margin">提报内容</p>
  37. <div class="handle">
  38. <div class="left">
  39. <Search />
  40. <DownSelect title="提报要求:" :list="[{value:'按产品类别'},{value:'按产品类别 + 项目'}]" style="margin-right:16px" />
  41. </div>
  42. <div class="right">
  43. <add-project @addSuccess="getSubmitList" />
  44. </div>
  45. </div>
  46. </div>
  47. <merge-table v-if="list" :layout="tablecols" :custom="true" :data1="list" :endFalse="true">
  48. <template v-slot:customcol="scope">
  49. <span v-if="scope.column.data[scope.column.columnname]">{{scope.column.data[scope.column.columnname]}}</span>
  50. <span v-if="!scope.column.data[scope.column.columnname] && scope.column.columnname != 'product_handle' && scope.column.columnname != 'project_handle'">-</span>
  51. </template>
  52. <template v-slot:product_handle="scope">
  53. <div style="display:flex">
  54. <edit :editData="scope.data" :tablecols="addProductTablecols" @editSuccess="getSubmitList" />
  55. <delete :rowData="scope.data" :projectid="0" @deleteSuccess="getSubmitList"/>
  56. </div>
  57. </template>
  58. <template v-slot:project_handle="scope">
  59. <div style="display:flex">
  60. <add-product :data1="scope" :productList="productList" :tablecols="addProductTablecols" @addSuccess="getSubmitList" />
  61. <delete :rowData="scope.data" :projectid="scope.data.sa_projectid" @deleteSuccess="getSubmitList" />
  62. </div>
  63. </template>
  64. </merge-table>
  65. </div>
  66. </template>
  67. <script>
  68. import Search from '@/components/search/index'
  69. import DownSelect from '@/components/down_select/index'
  70. import addProject from '../components/addProject'
  71. import mergeTable from '../components/mergeTable'
  72. import edit from '../components/edit'
  73. import Delete from '../components/delete'
  74. import addProduct from '../components/addProduct'
  75. export default {
  76. name: '',
  77. data() {
  78. return {
  79. id:this.$route.query.id,
  80. detail:'',
  81. list:'',
  82. tablecols:'',
  83. /* 添加产品表格 */
  84. addProductTablecols:'',
  85. productList:''
  86. };
  87. },
  88. components:{Search, DownSelect , addProject , mergeTable , edit , Delete , addProduct},
  89. computed:{
  90. },
  91. watch:{
  92. },
  93. filters: {
  94. timer (val, type) {
  95. if (type == '月') {
  96. return '每月' + val.substr(1, val.length - 2) + '日'
  97. } else {
  98. return '每周' + val.substr(1, val.length - 2)
  99. }
  100. }
  101. },
  102. created() {
  103. this.getHeaderDetail()
  104. this.getProductList()
  105. this.tablecols = this.tool.tabelCol(this.$route.name).salesEditTable.tablecols
  106. this.addProductTablecols = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
  107. console.log(this.addProductTablecols);
  108. },
  109. methods: {
  110. /* 获取详情表头数据 */
  111. async getHeaderDetail() {
  112. let res
  113. if(this.$route.query.type == 'panel') {
  114. res = await this.$api.requested({
  115. "id": 20220906154603,
  116. "version":1,
  117. "content": {
  118. "sa_salesforecastmodelid":this.$route.query.id2
  119. }
  120. })
  121. this.detail = res.data
  122. } else {
  123. res = await this.$api.requested({
  124.     "id": 20220914104603,
  125.     "version":1,
  126.     "content": {
  127.         "sa_salesforecastbillid":this.id
  128.     }
  129. })
  130. this.detail = res.data[0]
  131. }
  132. this.getSubmitList()
  133. console.log(this.detail);
  134. },
  135. /* 获取详情提报内容数据 */
  136. async getSubmitList() {
  137. let res = await this.$api.requested({
  138. "id": 20220906154703,
  139. "version":1,
  140. "content": {
  141. "nocache":true,
  142. "sa_salesforecastbillid":this.id,
  143. "where":{
  144. "condition":""
  145. }
  146. }
  147. })
  148. console.log(res.data);
  149. res.data[0].sa_projectid ? this.list = res.data : this.list = []
  150. },
  151. /* 获取所有产品数据 */
  152. async getProductList() {
  153. let res = await this.$api.requested({
  154. "id": 20220906154903,
  155. "version":1,
  156. "content": {
  157. }
  158. })
  159. this.productList = res.data
  160. console.log(this.productList);
  161. }
  162. },
  163. };
  164. </script>
  165. <style scoped>
  166. .handle {
  167. display: flex;
  168. justify-content: space-between;
  169. align-items: center;
  170. }
  171. .handle .left {
  172. display: flex;
  173. align-items: center;
  174. }
  175. </style>