editSales.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div>
  3. <!--模板头部-->
  4. <div class="container normal-panel" v-if="$route.query.header == '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" 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 @searchActive="searchActive" @clearData="clearData" />
  40. <!-- <DownSelect title="提报要求:" :list="[{value:'按产品类别'},{value:'按产品类别 + 项目'}]" style="margin-right:16px" /> -->
  41. </div>
  42. <div class="right">
  43. <add-project v-if="tool.checkAuth($route.name,'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 v-if="tool.checkAuth($route.name,'update')" :editData="scope.data" :tablecols="addProductTablecols" @editSuccess="getSubmitList" />
  55. <delete v-if="tool.checkAuth($route.name,'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 v-if="tool.checkAuth($route.name,'add_product')" :data1="scope" type="project" :productList="productList" :tablecols="addProductTablecols" @addSuccess="getSubmitList" />
  61. <delete v-if="tool.checkAuth($route.name,'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. /* 产品表 */
  86. productDetailTable:'',
  87. productList:'',
  88. condition:''
  89. };
  90. },
  91. components:{Search, DownSelect , addProject , mergeTable , Edit , Delete , addProduct},
  92. computed:{
  93. },
  94. watch:{
  95. },
  96. filters: {
  97. timer (val, type) {
  98. if (type == '月') {
  99. return '每月' + val.substr(1, val.length - 2) + '日'
  100. } else {
  101. return '每周' + val.substr(1, val.length - 2)
  102. }
  103. }
  104. },
  105. created() {
  106. this.getHeaderDetail()
  107. this.getProductList()
  108. this.tablecols = this.tool.tabelCol(this.$route.name).salesEditTable.tablecols
  109. this.productDetailTable = this.tool.tabelCol(this.$route.name).productDetailTable.tablecols
  110. this.addProductTablecols = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
  111. console.log(this.addProductTablecols);
  112. },
  113. methods: {
  114. /* 获取详情表头数据 */
  115. async getHeaderDetail() {
  116. let res
  117. if(this.$route.query.type == 'panel') {
  118. res = await this.$api.requested({
  119. "id": 20220906154603,
  120. "version":1,
  121. "content": {
  122. "sa_salesforecastmodelid":this.$route.query.id2
  123. }
  124. })
  125. this.detail = res.data
  126. } else {
  127. res = await this.$api.requested({
  128.     "id": 20220914104603,
  129.     "version":1,
  130.     "content": {
  131.         "sa_salesforecastbillid":this.id
  132.     }
  133. })
  134. this.detail = res.data[0]
  135. }
  136. this.getSubmitList()
  137. console.log(this.detail);
  138. },
  139. /* 获取详情提报内容数据 */
  140. async getSubmitList() {
  141. let res = await this.$api.requested({
  142. "id": 20220906154703,
  143. "version":1,
  144. "content": {
  145. "nocache":true,
  146. "sa_salesforecastbillid":this.id,
  147. "where":{
  148. "condition": this.condition
  149. }
  150. }
  151. })
  152. this.list = res.data.filter(item => item.projectnum)
  153. },
  154. /* 获取所有产品数据 */
  155. async getProductList() {
  156. let res = await this.$api.requested({
  157. "id": 20220906154903,
  158. "version":1,
  159. "content": {
  160. }
  161. })
  162. this.productList = res.data
  163. console.log(this.productList);
  164. },
  165. searchActive(data) {
  166. this.condition = data
  167. this.getSubmitList()
  168. },
  169. clearData() {
  170. this.condition = ''
  171. this.getSubmitList()
  172. }
  173. },
  174. };
  175. </script>
  176. <style scoped>
  177. .handle {
  178. display: flex;
  179. justify-content: space-between;
  180. align-items: center;
  181. }
  182. .handle .left {
  183. display: flex;
  184. align-items: center;
  185. }
  186. </style>