colTol.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="colTol">
  3. <el-drawer
  4. title="隐藏列"
  5. :visible.sync="open"
  6. direction="rtl"
  7. @close='upIsShow'
  8. size="20%">
  9. <transition name="fade">
  10. <div class="columnOption">
  11. <div class="content">
  12. <el-row v-for="(item, index) in arrs" :key="index" style="font-size: 14px;font-weight: bold;margin-bottom: 10px;padding: 0 20px;">
  13. <el-col :span="18">
  14. <span>{{item.label}}</span>
  15. </el-col>
  16. <el-col :span="6">
  17. <el-switch size="mini" v-model="prop[item.prop]"></el-switch>
  18. </el-col>
  19. </el-row>
  20. <!-- <el-switch v-model="prop.materialClassifyOneName">一级品类</el-switch>
  21. <el-switch v-model="prop.materialCode">物料编码</el-switch>
  22. <el-switch v-model="prop.materialName">品名</el-switch>
  23. <el-switch v-model="prop.specification">规格</el-switch>
  24. <el-switch v-model="prop.unit">单位</el-switch>
  25. <el-switch v-model="prop.manufacturer">生产厂家/代理人</el-switch>
  26. <el-switch v-model="prop.demandNum">需求单位数</el-switch>
  27. <el-switch v-model="prop.evensalesforyear">近1月月均需求</el-switch>
  28. <el-switch v-model="prop.evensalesforthrmonth">近3月月均需求</el-switch>
  29. <el-switch v-model="prop.netDemandNum">总最终净需求量</el-switch>
  30. <el-switch v-model="prop.totalMonthlySales">总月销量</el-switch>
  31. <el-switch v-model="prop.demandCycle">需求可用周期</el-switch>
  32. <el-switch v-model="prop.dullQut">呆滞量</el-switch>
  33. <el-switch v-model="prop.buyPeriod">采购周期</el-switch>
  34. <el-switch v-model="prop.centralPublicStock">中心公共库存</el-switch>
  35. <el-switch v-model="prop.centralWarehouse">中心仓专属货位</el-switch>
  36. <el-switch v-model="prop.regionPublicStock">区域分仓公共库存</el-switch>
  37. <el-switch v-model="prop.eachWarehouseStock">各项目仓库存</el-switch>
  38. <el-switch v-model="prop.commerceWarehouse">电商仓库</el-switch>
  39. <el-switch v-model="prop.buyTransit">采购在途</el-switch>
  40. <el-switch v-model="prop.lendTransit">借出在途</el-switch>
  41. <el-switch v-model="prop.transferTransit">调拨在途</el-switch>
  42. <el-switch v-model="prop.stockTotal">库存总计</el-switch>
  43. <el-switch v-model="prop.minPackage">最小包装量</el-switch>
  44. <el-switch v-model="prop.minOrder">最小订货量</el-switch>
  45. <el-switch v-model="prop.minBatch">最小批量</el-switch>
  46. <el-switch v-model="prop.artificialAdjust">人工调整数</el-switch>
  47. <el-switch v-model="prop.modifyReason">修改原因</el-switch>
  48. <el-switch v-model="prop.suggestionPurchase">建议采购量</el-switch>
  49. <el-switch v-model="prop.finalBuyQty">最终采购量</el-switch>
  50. <el-switch v-model="prop.materialClassifyTwoName">二级品类</el-switch>
  51. <el-switch v-model="prop.materialClassifyThreeName">三级品类</el-switch>
  52. <el-switch v-model="prop.materialClassifyFourName">四级品类</el-switch>
  53. <el-switch v-model="prop.buyerName">采购员</el-switch>
  54. <el-switch v-model="prop.purchaseOrgName">默认采购组织</el-switch>
  55. <el-switch v-model="prop.validityPeriod">有效期</el-switch>
  56. <el-switch v-model="prop.validityPeriodUnit">有效期单位</el-switch>
  57. <el-switch v-model="prop.businessType">业务类型</el-switch>
  58. <el-switch v-model="prop.safetyStock">安全库存量</el-switch>
  59. <el-switch v-model="prop.billSource">单据来源</el-switch>
  60. <el-switch v-model="prop.registrant">注册人</el-switch>
  61. <el-switch v-model="prop.buyDiscrepancy">总需与终采差异</el-switch>
  62. <el-switch v-model="prop.forecastClassification">集团预测分类</el-switch>
  63. <el-switch v-model="prop.centerBinPossession">中心仓占有量</el-switch>
  64. <el-switch v-model="prop.centralWarehouseAvailable">中心仓可用量</el-switch>
  65. <el-switch v-model="prop.puManagerAuditor">采购经理审核人</el-switch> -->
  66. </div>
  67. <!-- <div class="footer">
  68. <el-button size="mini" type="primary" plain @click="saveColumn"
  69. >确认</el-button
  70. >
  71. </div> -->
  72. </div>
  73. </transition>
  74. </el-drawer>
  75. </div>
  76. </template>
  77. <script>
  78. export default {
  79. props: {
  80. isVisible: {
  81. type: Boolean,
  82. default: false
  83. },
  84. showColumn: {
  85. type: Object,
  86. default: {}
  87. },
  88. arrs: {
  89. type: Array,
  90. default: []
  91. }
  92. },
  93. data() {
  94. return {
  95. open: false,
  96. // 列的配置化对象,存储配置信息
  97. prop: {},
  98. column: {
  99. status: true,
  100. materialClassifyOneName: true,
  101. materialCode: true,
  102. materialName: true,
  103. specification: true,
  104. unit: true,
  105. manufacturer: true,
  106. demandNum: true,
  107. evensalesforyear: true,
  108. evensalesforthrmonth: true,
  109. netDemandNum: true,
  110. totalMonthlySales: true,
  111. demandCycle: true,
  112. dullQut: true,
  113. buyPeriod: true,
  114. centralPublicStock: true,
  115. centralWarehouse: true,
  116. regionPublicStock: true,
  117. eachWarehouseStock: true,
  118. commerceWarehouse: true,
  119. buyTransit: true,
  120. lendTransit: true,
  121. transferTransit: true,
  122. stockTotal: true,
  123. minPackage: true,
  124. minOrder: true,
  125. minBatch: true,
  126. artificialAdjust: true,
  127. modifyReason: true,
  128. suggestionPurchase: true,
  129. finalBuyQty: true,
  130. materialClassifyTwoName: true,
  131. materialClassifyThreeName: true,
  132. materialClassifyFourName: true,
  133. buyerName: true,
  134. purchaseOrgName: true,
  135. validityPeriod: true,
  136. validityPeriodUnit: true,
  137. businessType: true,
  138. safetyStock: true,
  139. billSource: true,
  140. registrant: true,
  141. buyDiscrepancy: true,
  142. forecastClassification: true,
  143. centerBinPossession: true,
  144. centralWarehouseAvailable: true,
  145. puManagerAuditor: true,
  146. },
  147. }
  148. },
  149. mounted() {
  150. // 发请求得到checkListInitData的列的名字
  151. if(localStorage.getItem("columnSet")){
  152. this.prop = JSON.parse(localStorage.getItem("columnSet"))
  153. }else{
  154. this.prop = {
  155. status: true,
  156. materialClassifyOneName: true,
  157. materialCode: true,
  158. materialName: true,
  159. specification: true,
  160. unit: true,
  161. manufacturer: true,
  162. demandNum: true,
  163. evensalesforyear: true,
  164. evensalesforthrmonth: true,
  165. netDemandNum: true,
  166. totalMonthlySales: true,
  167. demandCycle: true,
  168. dullQut: true,
  169. buyPeriod: true,
  170. centralPublicStock: true,
  171. centralWarehouse: true,
  172. regionPublicStock: true,
  173. eachWarehouseStock: true,
  174. commerceWarehouse: true,
  175. buyTransit: true,
  176. lendTransit: true,
  177. transferTransit: true,
  178. stockTotal: true,
  179. minPackage: true,
  180. minOrder: true,
  181. minBatch: true,
  182. artificialAdjust: true,
  183. modifyReason: true,
  184. suggestionPurchase: true,
  185. finalBuyQty: true,
  186. materialClassifyTwoName: true,
  187. materialClassifyThreeName: true,
  188. materialClassifyFourName: true,
  189. buyerName: true,
  190. purchaseOrgName: true,
  191. validityPeriod: true,
  192. validityPeriodUnit: true,
  193. businessType: true,
  194. safetyStock: true,
  195. billSource: true,
  196. registrant: true,
  197. buyDiscrepancy: true,
  198. forecastClassification: true,
  199. centerBinPossession: true,
  200. centralWarehouseAvailable: true,
  201. puManagerAuditor: true,
  202. };
  203. }
  204. },
  205. methods: {
  206. upIsShow() {
  207. this.$emit('update:isVisible',false)//修改isDrawer的值
  208. },
  209. //设置列的 显示/隐藏
  210. changeShow(item) {
  211. item.show = !item.show
  212. },
  213. // showColumnOption() {
  214. // this.isShowColumn = true;
  215. // },
  216. saveColumn() {
  217. localStorage.setItem("columnSet",JSON.stringify(this.prop))
  218. // this.isShowColumn = false;
  219. this.upIsShow()
  220. },
  221. },
  222. watch: {
  223. isVisible: {
  224. handler(newValue) {
  225. this.open = newValue
  226. }
  227. },
  228. // 监听复选框配置列所有的变化
  229. prop: {
  230. handler: function (newnew, oldold) {
  231. console.log('新值',newnew);
  232. console.log('获取到表头没有?', this.arrs)
  233. this.column = newnew;
  234. this.$emit('update:showColumn', this.column)
  235. // 这里需要让表格重新绘制一下,否则会产生固定列错位的情况
  236. this.$nextTick(() => {
  237. // this.$refs.table.doLayout();
  238. this.$emit('reDraw')
  239. });
  240. },
  241. deep: true,
  242. immediate: true
  243. },
  244. }
  245. }
  246. </script>