index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @refresh-change="refreshChange" @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 270)"
  7. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 270)" :page.sync="page">
  8. <template slot-scope="{type,size,row,index}" slot="menu">
  9. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  10. <el-button :size="size" :type="type" :disabled="row.item >= 1" @click="$refs.crud.rowDel(row, index)">删除</el-button>
  11. </template>
  12. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  13. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新采购单</el-button>
  14. <!--<el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>-->
  15. </template>
  16. <template slot-scope="{row,index}" slot="stockClerkName">
  17. <el-select placeholder="请选择" v-if="row.$cellEdit" v-model="row.stockClerkName" size="small" filterable
  18. allow-create default-first-option clearable>
  19. <el-option v-for="item in stockClerkNameList" :key="item" :label="item.account" :value="item"></el-option>
  20. </el-select>
  21. <span v-else>{{ row.stockClerkName }}</span>
  22. </template>
  23. <template slot-scope="{type,size,row,$index}" slot="customerId">
  24. <span>{{ row.customerName}}</span>
  25. </template>
  26. <template slot-scope="{ row, index }" slot="billno">
  27. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.billno }}
  28. </span>
  29. </template>
  30. <template slot-scope="{ row, index }" slot="ordNo">
  31. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
  32. </span>
  33. </template>
  34. </avue-crud>
  35. </basic-container>
  36. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  37. </div>
  38. </template>
  39. <script>
  40. import { customerListAll } from "@/api/tirePartsMall/basicData/warehouse"
  41. import { getList, remove, getWarehouseKeeper } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  42. import detailsPage from "./detailsPage.vue"
  43. import { dateFormat } from '@/util/date'
  44. export default {
  45. name: "index",
  46. components: {
  47. detailsPage
  48. },
  49. data() {
  50. return {
  51. detailsOpen: false,
  52. salesCompanyId: '',
  53. storageNameList: [],
  54. stockClerkNameList: [],
  55. loading: false,
  56. search: {},
  57. form: {},
  58. dataList: [],
  59. detailData: {},
  60. page: {
  61. pageSize: 20,
  62. currentPage: 1,
  63. total: 0,
  64. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  65. },
  66. key: 0,
  67. option: {},
  68. optionList: {
  69. viewBtn: false,
  70. editBtn: false,
  71. delBtn: false,
  72. addBtn: false,
  73. index: true,
  74. span: 8,
  75. border: true,
  76. height: "auto",
  77. searchMenuPosition: "right",
  78. align: "center",
  79. size: "small",
  80. menuWidth: 50,
  81. searchSpan: 8,
  82. searchIcon: true,
  83. searchIndex: 2,
  84. highlightCurrentRow: true,
  85. dialogWidth: "70%",
  86. summaryText: "合计",
  87. showSummary: true,
  88. sumColumnList: [{
  89. name: "goodsTotalNum",
  90. type: "sum",
  91. decimals: 2
  92. }],
  93. column: [{
  94. label: "入库单号",
  95. prop: "billno",
  96. // billno
  97. search: true,
  98. overHidden: true,
  99. // width: 120,
  100. rules: [
  101. {
  102. required: true,
  103. message: " ",
  104. trigger: "blur"
  105. }
  106. ]
  107. }, {
  108. label: "来源单号",
  109. prop: "ordNo",
  110. search: true,
  111. overHidden: true,
  112. // width: 120,
  113. rules: [
  114. {
  115. required: true,
  116. message: " ",
  117. trigger: "blur"
  118. }
  119. ]
  120. }, {
  121. label: "业务对象",
  122. prop: "customerId",
  123. search: true,
  124. overHidden: true,
  125. type: 'select',
  126. props: {
  127. label: 'cname',
  128. value: 'id'
  129. },
  130. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS&enableOrNot=0',
  131. }, {
  132. label: "仓库",
  133. prop: "storageName",
  134. search: true,
  135. overHidden: true,
  136. // width: 120,
  137. type: 'select',
  138. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  139. props: {
  140. label: 'cname',
  141. value: 'id'
  142. },
  143. // change:(data)=>{
  144. // console.log(this.$refs.crud.DIC.storageName[0].salesCompanyId);
  145. // }
  146. }, {
  147. label: "轮胎数量",
  148. prop: "goodsTotalNum",
  149. search: false,
  150. overHidden: true,
  151. // width: 120,
  152. }, {
  153. label: "状态",
  154. prop: "statusName",
  155. search: true,
  156. overHidden: true,
  157. type: "select",
  158. dicData: [{
  159. label: "待入库",
  160. value: 0
  161. }, {
  162. label: "已入库",
  163. value: 1
  164. }],
  165. // width: 120,
  166. }, {
  167. label: "业务日期",
  168. prop: "createTime",
  169. search: true,
  170. overHidden: true,
  171. type: "datetime",
  172. value: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
  173. format: "yyyy-MM-dd HH:mm",
  174. valueFormat: "yyyy-MM-dd HH:mm:ss",
  175. // width: 200
  176. }, {
  177. label: "库管",
  178. prop: "stockClerkName",
  179. search: true,
  180. overHidden: true,
  181. type: 'select',
  182. props: {
  183. label: 'name',
  184. value: 'id'
  185. },
  186. dicUrl: "/api/blade-user/getWarehouseKeeper?salesCompanyId=" + JSON.parse(localStorage.getItem("saber-userInfo")).content.dept_id,
  187. // width: 200
  188. }, {
  189. label: "制单人",
  190. prop: "createUserName",
  191. searchProp: "createUser",
  192. overHidden: true,
  193. width: 100,
  194. filterable: true,
  195. remote: true,
  196. type: "select",
  197. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  198. props: {
  199. label: "account",
  200. value: "id",
  201. res: 'data.records'
  202. }
  203. }, {
  204. label: "制单日期",
  205. prop: "createTime",
  206. searchProp: "createTimeList",
  207. type: "date",
  208. overHidden: true,
  209. width: 100,
  210. searchRange: true,
  211. searchDefaultTime: ["00:00:00", "23:59:59"],
  212. format: "yyyy-MM-dd",
  213. valueFormat: "yyyy-MM-dd HH:mm:ss"
  214. }, {
  215. label: "更新人",
  216. prop: "updateUserName",
  217. searchProp: "updateUser",
  218. overHidden: true,
  219. width: 100,
  220. filterable: true,
  221. remote: true,
  222. type: "select",
  223. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  224. props: {
  225. label: "account",
  226. value: "id",
  227. res: 'data.records'
  228. }
  229. }, {
  230. label: "更新日期",
  231. prop: "updateTime",
  232. searchProp: "updateTimeList",
  233. type: "date",
  234. overHidden: true,
  235. width: 100,
  236. searchRange: true,
  237. searchDefaultTime: ["00:00:00", "23:59:59"],
  238. format: "yyyy-MM-dd",
  239. valueFormat: "yyyy-MM-dd HH:mm:ss"
  240. }]
  241. }
  242. }
  243. },
  244. async created() {
  245. customerListAll().then((res) => {
  246. this.storageNameList = res.data.data
  247. this.salesCompanyId = this.storageNameList[0].salesCompanyId;
  248. // stockClerkNameList
  249. getWarehouseKeeper({ salesCompanyId: this.salesCompanyId }).then(res => {
  250. this.stockClerkNameList = res.data.data;
  251. })
  252. })
  253. this.option = await this.getColumnData(this.getColumnName(274), this.optionList);
  254. this.key++
  255. let i = 0;
  256. this.option.column.forEach(item => {
  257. if (item.search) i++
  258. })
  259. if (i % 3 !== 0) {
  260. const num = 3 - Number(i % 3)
  261. this.option.searchMenuSpan = num * 8;
  262. this.option.searchMenuPosition = "right";
  263. }
  264. },
  265. mounted() {
  266. // console.log(this.$refs.crud);
  267. },
  268. methods: {
  269. check(row) {
  270. this.form = row
  271. this.detailsOpen = true
  272. },
  273. backToList(type) {
  274. this.form = {}
  275. this.detailsOpen = false
  276. if (type === 0) {
  277. this.detailData = {}
  278. }
  279. this.onLoad(this.page, this.search)
  280. },
  281. //刷新
  282. refreshChange() {
  283. this.onLoad(this.page, this.search)
  284. },
  285. rowDel(form, index) {
  286. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  287. confirmButtonText: '确定',
  288. cancelButtonText: '取消',
  289. type: 'warning'
  290. }).then(() => {
  291. remove(form.id).then(res => {
  292. this.$message({
  293. type: 'success',
  294. message: '删除成功!'
  295. });
  296. this.dataList.splice(index, 1);
  297. this.onLoad(this.page)
  298. })
  299. }).catch(() => {
  300. });
  301. },
  302. searchChange(params, done) {
  303. done();
  304. this.onLoad(this.page, params)
  305. },
  306. onLoad(page, params = {}) {
  307. params = {
  308. ...params,
  309. current: page.currentPage,
  310. size: page.pageSize,
  311. bizTypeName: "SHGD,TKSHGD",
  312. ...Object.assign(params, this.search)
  313. }
  314. this.loading = true
  315. getList(params).then(res => {
  316. this.dataList = res.data.data.records
  317. this.page.total = res.data.data.total
  318. this.loading = false
  319. }).finally(() => {
  320. this.loading = false
  321. })
  322. },
  323. editOpen(row, status) {
  324. this.form = row
  325. this.detailData = {
  326. id: row.id,
  327. status: status
  328. };
  329. this.detailsOpen = true;
  330. },
  331. //自定义列保存
  332. async saveColumnTwo(ref, option, optionBack, code) {
  333. /**
  334. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  335. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  336. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  337. */
  338. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  339. if (inSave) {
  340. this.$message.success("保存成功");
  341. //关闭窗口
  342. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  343. }
  344. },
  345. //自定义列重置
  346. async resetColumnTwo(ref, option, optionBack, code) {
  347. this[option] = this[optionBack];
  348. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  349. if (inSave) {
  350. this.$message.success("重置成功");
  351. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  352. }
  353. }
  354. }
  355. }
  356. </script>
  357. <style scoped></style>