斯瑞奇mes前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

365 lines
11 KiB

  1. <template>
  2. <div class="mod-config">
  3. <el-form v-model="searchData">
  4. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;" >
  5. <el-form-item :label="'店铺名称:'">
  6. <el-input v-model="searchData.shopName" style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label="'店铺编号:'">
  9. <el-input v-model="searchData.shopId" style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="' '">
  12. <el-button @click="refreshPageTables()" style="margin-left: 0px" type="primary">查询</el-button>
  13. <el-button @click="addOrUpdateModal('Y')" style="margin-left: 14px" type="primary">新增</el-button>
  14. <el-button @click="addOrUpdateModal('N')" style="margin-left: 14px" type="primary">修改</el-button>
  15. </el-form-item>
  16. <el-form-item :label="' '">
  17. <download-excel
  18. :fields="fields()"
  19. type="xls"
  20. :name="exportName"
  21. :fetch="createExportData"
  22. worksheet="导出信息"
  23. class="el-button el-button--primary el-button--medium">
  24. {{ '导出' }}
  25. </download-excel>
  26. </el-form-item>
  27. </el-form>
  28. </el-form>
  29. <el-table
  30. :height="height"
  31. :data="tableData"
  32. ref="fileTable"
  33. highlight-current-row
  34. @row-click="setCurrentRow"
  35. @current-change="changeCurrentRow"
  36. border
  37. style="width: 100%">
  38. <el-table-column
  39. v-for="(item,index) in columnList" :key="index"
  40. :sortable="item.columnSortable"
  41. :prop="item.columnProp"
  42. header-align="center"
  43. :show-overflow-tooltip="item.showOverflowTooltip"
  44. :align="item.align"
  45. :fixed="item.fixed==''?false:item.fixed"
  46. :min-width="item.columnWidth"
  47. :label="item.columnLabel">
  48. <template slot-scope="scope">
  49. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  50. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  51. style="width: 100px; height: 80px"/></span>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <!--新增或者修改-->
  56. <comAddUpdateShopStore ref="comAddUpdateShopStore" @refreshPageTables="refreshPageTables" v-drag></comAddUpdateShopStore>
  57. </div>
  58. </template>
  59. <script>
  60. import comAddUpdateShopStore from "./com_add_update_shop_store";
  61. import {
  62. getShopStores,
  63. insertShopStore,
  64. saveShopStore,
  65. } from '@/api/jst/shop_store.js'
  66. import Vue from 'vue'
  67. export default {
  68. name: 'salesOrder',
  69. data () {
  70. return {
  71. // 导出+动态列 start
  72. exportData: [],
  73. exportName: '店铺映射表' + this.getStrDate(),
  74. columnList: [
  75. {
  76. tableId: 'shopStoreHist',
  77. tableName: this.$route.meta.title,
  78. columnProp: 'contract',
  79. columnLabel: '域',
  80. columnHidden: false,
  81. columnImage: false,
  82. columnSortable: false,
  83. columnWidth: 30,
  84. format: null,
  85. functionId: this.$route.meta.menuId,
  86. sortLv: 0,
  87. status: true,
  88. fixed: '',
  89. serialNumber: null,
  90. columnType: null,
  91. align: 'left'
  92. },
  93. {
  94. tableId: 'shopStoreHist',
  95. tableName: this.$route.meta.title,
  96. columnProp: 'shopSite',
  97. columnLabel: '店铺站点',
  98. columnHidden: false,
  99. columnImage: false,
  100. columnSortable: false,
  101. columnWidth: 60,
  102. format: null,
  103. functionId: this.$route.meta.menuId,
  104. sortLv: 0,
  105. status: true,
  106. fixed: '',
  107. serialNumber: null,
  108. columnType: null,
  109. align: 'left'
  110. },
  111. {
  112. tableId: 'shopStoreHist',
  113. tableName: this.$route.meta.title,
  114. columnProp: 'shopId',
  115. columnLabel: '店铺编号',
  116. columnHidden: false,
  117. columnImage: false,
  118. columnSortable: false,
  119. columnWidth: 60,
  120. format: null,
  121. functionId: this.$route.meta.menuId,
  122. sortLv: 0,
  123. status: true,
  124. fixed: '',
  125. serialNumber: null,
  126. columnType: null,
  127. align: 'left'
  128. },
  129. {
  130. tableId: 'shopStoreHist',
  131. tableName: this.$route.meta.title,
  132. columnProp: 'shopName',
  133. columnLabel: '店铺名称',
  134. columnHidden: false,
  135. columnImage: false,
  136. columnSortable: false,
  137. columnWidth: 120,
  138. format: null,
  139. functionId: this.$route.meta.menuId,
  140. sortLv: 0,
  141. status: true,
  142. fixed: '',
  143. serialNumber: null,
  144. columnType: null,
  145. align: 'left'
  146. },
  147. {
  148. tableId: 'shopStoreHist',
  149. tableName: this.$route.meta.title,
  150. columnProp: 'customerNo',
  151. columnLabel: '客户编号',
  152. columnHidden: false,
  153. columnImage: false,
  154. columnSortable: false,
  155. columnWidth: 60,
  156. format: null,
  157. functionId: this.$route.meta.menuId,
  158. sortLv: 0,
  159. status: true,
  160. fixed: '',
  161. serialNumber: null,
  162. columnType: null,
  163. align: 'left'
  164. },
  165. {
  166. tableId: 'shopStoreHist',
  167. tableName: this.$route.meta.title,
  168. columnProp: 'pureCustom',
  169. columnLabel: '区分纯电商',
  170. columnHidden: false,
  171. columnImage: false,
  172. columnSortable: false,
  173. columnWidth: 60,
  174. format: null,
  175. functionId: this.$route.meta.menuId,
  176. sortLv: 0,
  177. status: true,
  178. fixed: '',
  179. serialNumber: null,
  180. columnType: null,
  181. align: 'left'
  182. },
  183. {
  184. tableId: 'shopStoreHist',
  185. tableName: this.$route.meta.title,
  186. columnProp: 'distinguishCustom',
  187. columnLabel: '区分客户',
  188. columnHidden: false,
  189. columnImage: false,
  190. columnSortable: false,
  191. columnWidth: 60,
  192. format: null,
  193. functionId: this.$route.meta.menuId,
  194. sortLv: 0,
  195. status: true,
  196. fixed: '',
  197. serialNumber: null,
  198. columnType: null,
  199. align: 'left'
  200. },
  201. {
  202. tableId: 'shopStoreHist',
  203. tableName: this.$route.meta.title,
  204. columnProp: 'consignmentFlag',
  205. columnLabel: '区分寄售',
  206. columnHidden: false,
  207. columnImage: false,
  208. columnSortable: false,
  209. columnWidth: 60,
  210. format: null,
  211. functionId: this.$route.meta.menuId,
  212. sortLv: 0,
  213. status: true,
  214. fixed: '',
  215. serialNumber: null,
  216. columnType: null,
  217. align: 'left'
  218. },
  219. {
  220. tableId: 'shopStoreHist',
  221. tableName: this.$route.meta.title,
  222. columnProp: 'orderType',
  223. columnLabel: '订单类型',
  224. columnHidden: false,
  225. columnImage: false,
  226. columnSortable: false,
  227. columnWidth: 60,
  228. format: null,
  229. functionId: this.$route.meta.menuId,
  230. sortLv: 0,
  231. status: true,
  232. fixed: '',
  233. serialNumber: null,
  234. columnType: null,
  235. align: 'right'
  236. },
  237. {
  238. tableId: 'shopStoreHist',
  239. tableName: this.$route.meta.title,
  240. columnProp: 'salesmanCode',
  241. columnLabel: '销售员',
  242. columnHidden: false,
  243. columnImage: false,
  244. columnSortable: false,
  245. columnWidth: 60,
  246. format: null,
  247. functionId: this.$route.meta.menuId,
  248. sortLv: 0,
  249. status: true,
  250. fixed: '',
  251. serialNumber: null,
  252. columnType: null,
  253. align: 'right'
  254. },
  255. ],
  256. currentRow:{},
  257. visible: false,
  258. // 导出 end
  259. height: 200,
  260. tableData: [],
  261. searchData: {
  262. shopName: '',
  263. shopId: '',
  264. },
  265. }
  266. },
  267. components: {
  268. comAddUpdateShopStore,/*新增或修改*/
  269. },
  270. mounted () {
  271. this.$nextTick(() => {
  272. this.height = window.innerHeight - 150
  273. })
  274. },
  275. methods: {
  276. refreshPageTables () {
  277. getShopStores(this.searchData).then(({data}) => {
  278. this.tableData = data.rows;
  279. if(data.total > 0){
  280. //设置选中行
  281. this.$refs.fileTable.setCurrentRow(this.tableData[0]);
  282. }
  283. })
  284. },
  285. /*设置工艺的行*/
  286. setCurrentRow(row, column, event) {
  287. this.currentRow = row;
  288. },
  289. // 选中记录
  290. /*当前值发生变化的时候修改*/
  291. changeCurrentRow(row, oldRow){
  292. //判断是否是获取焦点的事件
  293. if(row){
  294. this.currentRow = JSON.parse(JSON.stringify(row));
  295. }
  296. },
  297. // 导出+动态列
  298. fields () {
  299. let json = '{'
  300. this.columnList.forEach((item, index) => {
  301. if (index === this.columnList.length - 1) {
  302. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  303. } else {
  304. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  305. }
  306. })
  307. json += '}'
  308. return eval('(' + json + ')')
  309. },
  310. createExportData () {
  311. // 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据
  312. return this.tableData
  313. },
  314. getStrDate () {
  315. let dd = new Date()
  316. let Y = dd.getFullYear()
  317. let M = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1)// 获取当前月份的日期,不足10补0
  318. let D = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()// 获取当前几号,不足10补0
  319. let H = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  320. let MM = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  321. let S = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  322. return Y + M + D + H + MM + S
  323. },
  324. /*新增或修改的modal*/
  325. addOrUpdateModal(addFlag){
  326. //打开组件 去做新增业务
  327. this.$nextTick(() => {
  328. //区分是否是新增
  329. if('Y' === addFlag){
  330. this.$refs.comAddUpdateShopStore.init({}, addFlag);
  331. }else{
  332. this.$refs.comAddUpdateShopStore.init(this.currentRow, addFlag);
  333. }
  334. })
  335. },
  336. },
  337. created() {
  338. this.refreshPageTables();
  339. // this.getLanguageList()
  340. }
  341. }
  342. </script>
  343. <style scoped>
  344. </style>