index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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.account"></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. // searchProp:"storageId",
  135. // searchProp: "createUser",
  136. search: true,
  137. overHidden: true,
  138. // width: 120,
  139. type: 'select',
  140. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  141. props: {
  142. label: 'cname',
  143. value: 'id'
  144. },
  145. // change:(data)=>{
  146. // console.log(this.$refs.crud.DIC.storageName[0].salesCompanyId);
  147. // }
  148. }, {
  149. label: "轮胎数量",
  150. prop: "goodsTotalNum",
  151. search: false,
  152. overHidden: true,
  153. // width: 120,
  154. }, {
  155. label: "状态",
  156. prop: "statusName",
  157. search: true,
  158. overHidden: true,
  159. type: "select",
  160. dicData: [{
  161. label: "待入库",
  162. value: 0
  163. }, {
  164. label: "已入库",
  165. value: 1
  166. }],
  167. // width: 120,
  168. }, {
  169. label: "业务日期",
  170. prop: "createTime",
  171. search: true,
  172. overHidden: true,
  173. type: "datetime",
  174. value: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
  175. format: "yyyy-MM-dd HH:mm",
  176. valueFormat: "yyyy-MM-dd HH:mm:ss",
  177. // width: 200
  178. }, {
  179. label: "库管",
  180. prop: "stockClerkName",
  181. search: true,
  182. overHidden: true,
  183. type: 'select',
  184. props: {
  185. label: 'realName',
  186. value: 'id'
  187. },
  188. dicUrl: '/api/blade-user/stockClerkList',
  189. // props: {
  190. // label: 'name',
  191. // value: 'id'
  192. // },
  193. // dicUrl: "/api/blade-user/getWarehouseKeeper?salesCompanyId=" + JSON.parse(localStorage.getItem("saber-userInfo")).content.dept_id,
  194. // width: 200
  195. }, {
  196. label: "制单人",
  197. prop: "createUserName",
  198. searchProp: "createUser",
  199. overHidden: true,
  200. width: 100,
  201. filterable: true,
  202. remote: true,
  203. type: "select",
  204. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  205. props: {
  206. label: "account",
  207. value: "id",
  208. res: 'data.records'
  209. }
  210. }, {
  211. label: "制单日期",
  212. prop: "createTime",
  213. searchProp: "createTimeList",
  214. type: "date",
  215. overHidden: true,
  216. width: 100,
  217. searchRange: true,
  218. searchDefaultTime: ["00:00:00", "23:59:59"],
  219. format: "yyyy-MM-dd",
  220. valueFormat: "yyyy-MM-dd HH:mm:ss"
  221. }, {
  222. label: "更新人",
  223. prop: "updateUserName",
  224. searchProp: "updateUser",
  225. overHidden: true,
  226. width: 100,
  227. filterable: true,
  228. remote: true,
  229. type: "select",
  230. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  231. props: {
  232. label: "account",
  233. value: "id",
  234. res: 'data.records'
  235. }
  236. }, {
  237. label: "更新日期",
  238. prop: "updateTime",
  239. searchProp: "updateTimeList",
  240. type: "date",
  241. overHidden: true,
  242. width: 100,
  243. searchRange: true,
  244. searchDefaultTime: ["00:00:00", "23:59:59"],
  245. format: "yyyy-MM-dd",
  246. valueFormat: "yyyy-MM-dd HH:mm:ss"
  247. }]
  248. }
  249. }
  250. },
  251. async created() {
  252. customerListAll().then((res) => {
  253. this.storageNameList = res.data.data
  254. this.salesCompanyId = this.storageNameList[0].salesCompanyId;
  255. // stockClerkNameList
  256. getWarehouseKeeper({ salesCompanyId: this.salesCompanyId }).then(res => {
  257. this.stockClerkNameList = res.data.data;
  258. })
  259. })
  260. this.option = await this.getColumnData(this.getColumnName(274), this.optionList);
  261. this.key++
  262. let i = 0;
  263. this.option.column.forEach(item => {
  264. if (item.search) i++
  265. })
  266. if (i % 3 !== 0) {
  267. const num = 3 - Number(i % 3)
  268. this.option.searchMenuSpan = num * 8;
  269. this.option.searchMenuPosition = "right";
  270. }
  271. },
  272. mounted() {
  273. // console.log(this.$refs.crud);
  274. },
  275. methods: {
  276. check(row) {
  277. this.form = row
  278. this.detailsOpen = true
  279. },
  280. backToList(type) {
  281. this.form = {}
  282. this.detailsOpen = false
  283. if (type === 0) {
  284. this.detailData = {}
  285. }
  286. this.onLoad(this.page, this.search)
  287. },
  288. //刷新
  289. refreshChange() {
  290. this.onLoad(this.page, this.search)
  291. },
  292. rowDel(form, index) {
  293. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  294. confirmButtonText: '确定',
  295. cancelButtonText: '取消',
  296. type: 'warning'
  297. }).then(() => {
  298. remove(form.id).then(res => {
  299. this.$message({
  300. type: 'success',
  301. message: '删除成功!'
  302. });
  303. this.dataList.splice(index, 1);
  304. this.onLoad(this.page)
  305. })
  306. }).catch(() => {
  307. });
  308. },
  309. searchChange(params, done) {
  310. console.log(params);
  311. done();
  312. this.onLoad(this.page, params)
  313. },
  314. onLoad(page, params = {}) {
  315. console.log(this.search);
  316. params = {
  317. ...params,
  318. current: page.currentPage,
  319. size: page.pageSize,
  320. bizTypeName: "SHGD,TKSHGD",
  321. ...Object.assign(params, this.search),
  322. storageId:this.search.storageName,
  323. statusName:this.search.$statusName,
  324. stockClerkName:this.search.$stockClerkName
  325. }
  326. this.loading = true
  327. getList(params).then(res => {
  328. this.dataList = res.data.data.records
  329. this.page.total = res.data.data.total
  330. this.loading = false
  331. }).finally(() => {
  332. this.loading = false
  333. })
  334. },
  335. editOpen(row, status) {
  336. this.form = row
  337. this.detailData = {
  338. id: row.id,
  339. status: status
  340. };
  341. this.detailsOpen = true;
  342. },
  343. //自定义列保存
  344. async saveColumnTwo(ref, option, optionBack, code) {
  345. /**
  346. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  347. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  348. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  349. */
  350. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  351. if (inSave) {
  352. this.$message.success("保存成功");
  353. //关闭窗口
  354. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  355. }
  356. },
  357. //自定义列重置
  358. async resetColumnTwo(ref, option, optionBack, code) {
  359. this[option] = this[optionBack];
  360. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  361. if (inSave) {
  362. this.$message.success("重置成功");
  363. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  364. }
  365. }
  366. }
  367. }
  368. </script>
  369. <style scoped></style>