index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <div>
  3. <Toptitle>
  4. <template #left>
  5. <Button type="primary" @click="is_open = !is_open">{{
  6. is_open ? "收缩" : "展开"
  7. }}</Button>
  8. </template>
  9. <template #right>
  10. <Button type="warning" ghost @click="handleExport">导出</Button>
  11. <Dropdown style="margin-left: 10px" @on-click="handleClick">
  12. <Button type="primary">
  13. 操作
  14. <Icon type="ios-arrow-down"></Icon>
  15. </Button>
  16. <DropdownMenu slot="list">
  17. <DropdownItem :name="1">新增</DropdownItem>
  18. <DropdownItem :name="2">批量删除</DropdownItem>
  19. <DropdownItem :name="3">领料单过桥</DropdownItem>
  20. </DropdownMenu>
  21. </Dropdown>
  22. </template>
  23. </Toptitle>
  24. <div
  25. :style="
  26. is_open
  27. ? 'max-height:200px;transition: all .5s;overflow:auto'
  28. : 'max-height:0px;overflow: hidden;transition: all .5s;'
  29. "
  30. >
  31. <Form :label-width="120" style="display: flex; flex-wrap: wrap">
  32. <FormItem label="单据编号">
  33. <Input
  34. v-model="searchData.order_number"
  35. clearable
  36. style="width: 200px"
  37. placeholder="请输入"
  38. />
  39. </FormItem>
  40. <FormItem label="制单日期">
  41. <DatePicker
  42. v-model="searchData.crt_time"
  43. clearable
  44. transfer
  45. type="daterange"
  46. style="width: 200px"
  47. placeholder="年/月/日"
  48. />
  49. </FormItem>
  50. <FormItem label="发货日期">
  51. <DatePicker
  52. v-model="searchData.send_time"
  53. clearable
  54. transfer
  55. type="daterange"
  56. style="width: 200px"
  57. placeholder="年/月/日"
  58. />
  59. </FormItem>
  60. <FormItem label="账套标识">
  61. <Select transfer clearable style="width: 200px" v-model="searchData.roll_film_type_name">
  62. <Option value="太阳膜" label="太阳膜"/>
  63. <Option value="漆面膜" label="漆面膜"/>
  64. </Select>
  65. </FormItem>
  66. <FormItem label="所属区域">
  67. <Select
  68. v-model="searchData.area"
  69. filterable
  70. clearable
  71. style="width: 200px"
  72. transfer
  73. >
  74. <Option
  75. v-for="item in areaList"
  76. :key="item.id"
  77. :value="item.id"
  78. :label="item.title"
  79. />
  80. </Select>
  81. </FormItem>
  82. <FormItem label="要货单位">
  83. <Input
  84. v-model="searchData.employee"
  85. clearable
  86. style="width: 200px"
  87. placeholder="请输入"
  88. />
  89. </FormItem>
  90. <FormItem label="是否过桥">
  91. <Select transfer clearable style="width: 200px" v-model="searchData.bz">
  92. <Option :value="0" label="否"/>
  93. <Option :value="1" label="是"/>
  94. </Select>
  95. </FormItem>
  96. <FormItem label="所属集团">
  97. <Select
  98. v-model="searchData.company_id"
  99. filterable
  100. clearable
  101. style="width: 200px"
  102. transfer
  103. >
  104. <Option
  105. v-for="item in companyList"
  106. :key="item.id"
  107. :value="item.id"
  108. :label="item.title"
  109. />
  110. </Select>
  111. </FormItem>
  112. <FormItem label="仓库名称">
  113. <Select
  114. transfer
  115. filterable
  116. clearable
  117. v-model="searchData.storehouse_id"
  118. style="width: 200px"
  119. >
  120. <Option
  121. v-for="item in storehouseList"
  122. :key="item.id"
  123. :value="item.id"
  124. :label="item.title"
  125. />
  126. </Select>
  127. </FormItem>
  128. <FormItem label="4s店名称">
  129. <Select
  130. v-model="searchData.four_shop_id"
  131. filterable
  132. clearable
  133. style="width: 200px"
  134. transfer
  135. >
  136. <Option
  137. v-for="item in fourShopList"
  138. :key="item.id"
  139. :value="item.id"
  140. :label="item.title"
  141. />
  142. </Select>
  143. </FormItem>
  144. <FormItem label="卷膜编号">
  145. <Input
  146. v-model="searchData.roll_film_number"
  147. clearable
  148. style="width: 200px"
  149. placeholder="请输入"
  150. />
  151. </FormItem>
  152. <FormItem label="卷膜型号" class="item">
  153. <Input
  154. v-model="searchData.roll_film_title"
  155. clearable
  156. placeholder="请输入"
  157. style="width: 200px"
  158. />
  159. </FormItem>
  160. <FormItem label="收货审核日期">
  161. <DatePicker
  162. v-model="searchData.upd_time"
  163. clearable
  164. transfer
  165. type="daterange"
  166. style="width: 200px"
  167. placeholder="年/月/日"
  168. />
  169. </FormItem>
  170. <FormItem label="申领状态">
  171. <Select filterable clearable style="width: 200px" v-model="searchData.apply_status" transfer>
  172. <Option :value="0" label="未审核"/>
  173. <Option :value="1" label="待审核"/>
  174. <Option :value="2" label="审核通过"/>
  175. </Select>
  176. </FormItem>
  177. <FormItem label="发货状态">
  178. <Select filterable clearable style="width: 200px" v-model="searchData.send_status" transfer>
  179. <Option :value="0" label="未审核"/>
  180. <Option :value="1" label="待审核"/>
  181. <Option :value="2" label="已发货"/>
  182. </Select>
  183. </FormItem>
  184. <FormItem label="收货状态">
  185. <Select filterable clearable style="width: 200px" v-model="searchData.take_status" transfer>
  186. <Option :value="0" label="未审核"/>
  187. <Option :value="1" label="待审核"/>
  188. <Option :value="2" label="已收货"/>
  189. </Select>
  190. </FormItem>
  191. <FormItem :label-width="40">
  192. <Button type="primary" @click="handleSearch">查询</Button>
  193. </FormItem>
  194. </Form>
  195. </div>
  196. <div class="table_content">
  197. <vxe-grid
  198. v-bind="gridOptions"
  199. @checkbox-all="selectAllEvent"
  200. @checkbox-change="selectChangeEvent"
  201. >
  202. <template #set="{ row }">
  203. <a style="margin-right: 10px" @click="handleSet(3, row)">详情</a>
  204. <a style="margin-right: 10px" @click="handleSet(2, row)">编辑</a>
  205. <a @click="handleDel(row)">删除</a>
  206. </template>
  207. </vxe-grid>
  208. </div>
  209. <Footer
  210. :pageSize="pageSize"
  211. :pageIndex="pageIndex"
  212. :total="total"
  213. @changeSize="changeSize"
  214. @changePage="changePage"
  215. ></Footer>
  216. <Modal width="400" title="领料单过桥" :closable="true" :mask-closable="true" v-model="showGuo" draggable>
  217. <Form :label-width="100">
  218. <FormItem label="过桥时间:">
  219. <DatePicker
  220. v-model="time"
  221. clearable
  222. type="datetime"
  223. format="yyyy-MM-dd HH:mm:ss"
  224. style="width: 200px"
  225. transfer
  226. placeholder="年/月/日"
  227. />
  228. </FormItem>
  229. </Form>
  230. <div slot="footer">
  231. <Button style="margin-right: 10px;" @click="showGuo=false">取消</Button>
  232. <Button type="primary" ghost @click="handleSureGuo">确认</Button>
  233. </div>
  234. </Modal>
  235. </div>
  236. </template>
  237. <script>
  238. export default {
  239. data() {
  240. return {
  241. showGuo:false,
  242. time:'',
  243. is_open: false,
  244. pageSize: 10,
  245. pageIndex: 1,
  246. total: 0,
  247. sort: null,
  248. is_show: false,
  249. selectData: [],
  250. searchData: {},
  251. proxyData: {},
  252. gridOptions: {
  253. border: true,
  254. resizable: true,
  255. maxHeight: 'auto',
  256. showOverflow: true,
  257. align: 'left',
  258. columns: [
  259. { type: 'checkbox', width: 50, fixed: 'left' },
  260. { field: 'set', title: '操作', showHeaderOverflow: true, slots: { default: 'set' }, fixed: 'left', width: 160, align: 'center' },
  261. { field: 'crt_time', title: '制单日期', showHeaderOverflow: true, minWidth: 100 },
  262. { field: 'order_number', title: '单据编号', showHeaderOverflow: true, minWidth: 100 },
  263. { field: 'company_name', title: '所属集团', showHeaderOverflow: true, minWidth: 100 },
  264. { field: 'four_shop_name', title: '4s店名称', showHeaderOverflow: true, minWidth: 100 },
  265. { field: 'regional_manager_name', title: '区域经理', showHeaderOverflow: true, minWidth: 100 },
  266. { field: 'bz', title: '是否过桥', showHeaderOverflow: true, minWidth: 100,slots: {default: (params,h)=>{
  267. const {row} = params;
  268. return h('span',{},row.bz?'是':'否')
  269. }} },
  270. { field: 'crt_name', title: '提交人', showHeaderOverflow: true, minWidth: 100 },
  271. { field: 'apply_name', title: '申领人', showHeaderOverflow: true, minWidth: 100 },
  272. // { field: 'default_num', title: '申领审核人', showHeaderOverflow: true, minWidth: 100 },
  273. { field: 'send_name', title: '发货人', showHeaderOverflow: true, minWidth: 100 },
  274. // { field: 'warranty_day', title: '发货审核人', showHeaderOverflow: true, minWidth: 100 },
  275. { field: 'take', title: '收货人', showHeaderOverflow: true, minWidth: 100 },
  276. { field: 'apply_status_name', title: '申领状态', showHeaderOverflow: true, minWidth: 100 },
  277. { field: 'send_status_name', title: '发货状态', showHeaderOverflow: true, minWidth: 100 },
  278. { field: 'take_status_name', title: '收货状态', showHeaderOverflow: true, minWidth: 100 },
  279. // { field: 'warranty_day', title: '收货审核人', showHeaderOverflow: true, minWidth: 100 }
  280. ],
  281. data: []
  282. },
  283. fourShopList: [],
  284. storehouseList:[],
  285. companyList: [],
  286. areaList:[]
  287. }
  288. },
  289. created() {
  290. //获取4s店列表
  291. this.axios.post('/api/foursShopList').then(res => {
  292. this.fourShopList = res.data.data;
  293. })
  294. //所属集团
  295. this.axios.post('/api/companyList').then(res => {
  296. this.companyList = res.data.data;
  297. })
  298. //获取仓库
  299. this.axios.post('/api/storehouseList').then(res => {
  300. this.storehouseList = res.data.data;
  301. })
  302. //获取区域
  303. this.axios.post('/api/areaList').then(res => {
  304. this.areaList = this.getArr(res.data);
  305. })
  306. },
  307. mounted() {
  308. this.initData();
  309. },
  310. methods: {
  311. handleSureGuo(){
  312. let time = this.time?Date.parse(new Date(this.time)).toString().slice(0,10):''
  313. this.$Modal.confirm({
  314. title:'确认',
  315. content:"确认过桥?",
  316. onOk:()=>{
  317. this.axios.post('/api/thirdMaterial',{id:this.selectData.map(v=>v.id),time}).then(res=>{
  318. if(res.code==200){
  319. this.$Message.success(res.msg);
  320. this.initData(this.proxyData);
  321. this.selectData = [];
  322. }
  323. })
  324. }
  325. })
  326. },
  327. getArr(arr) {
  328. let data = [];
  329. arr.forEach(ele => {
  330. if (ele.children.length != 0) {
  331. data = [...data, ...this.getArr(ele.children)];
  332. } else {
  333. data.push(ele);
  334. }
  335. });
  336. return data;
  337. },
  338. async handleExport(){
  339. if(this.selectData.length==0){
  340. return this.$Message.warning('请选择需要导出的数据!')
  341. }
  342. let id = this.selectData.map(v=>v.id);
  343. const res = await this.axios.post('/api/exportFile',{type:1,id})
  344. if(res.code === 200){
  345. let url = `${this.$store.state.ip}/api/getExport/${res.data.file}`
  346. location.href = url
  347. }
  348. },
  349. handleSet(num, row) {
  350. switch (num) {
  351. case 1://新增
  352. this.$router.push({ path: '/cms/BusinessManagement/Picking/detail', query: { type: 1, title: "新增领料单" } })
  353. break;
  354. case 2://编辑
  355. this.$router.push({ path: '/cms/BusinessManagement/Picking/detail', query: { type: 2, title: '编辑领料单', order_number: row.order_number } })
  356. break;
  357. case 3://详情
  358. this.$router.push({ path: '/cms/BusinessManagement/Picking/detail', query: { type: 3, title: '领料单详情', order_number: row.order_number } })
  359. break;
  360. }
  361. },
  362. handleClick(name) {
  363. if (name == 1) {//新增
  364. this.handleSet(1)
  365. } else if (name == 2) {//批量删除
  366. if (this.selectData.length == 0) {
  367. return this.$Message.warning('请选择数据!')
  368. }
  369. this.handleDel();
  370. }else if (name == 3){
  371. if (this.selectData.length == 0) {
  372. return this.$Message.warning('请选择数据!')
  373. }
  374. this.showGuo = true;
  375. this.time = this.func.replaceDate(this.selectData[0].upd_time);
  376. }
  377. },
  378. selectAllEvent(e) {
  379. this.selectData = e.records;
  380. },
  381. selectChangeEvent(e) {
  382. this.selectData = e.records;
  383. },
  384. handleDel(row) {
  385. this.$Modal.confirm({
  386. title:'删除',
  387. content:'确认删除嘛?',
  388. onOk:()=>{
  389. let order_number;
  390. if (row) {
  391. order_number = [row.order_number];
  392. } else {
  393. order_number = this.selectData.map(v => {
  394. return v.order_number;
  395. })
  396. }
  397. this.axios.post('/api/materialOrderDel', { order_number }).then(res => {
  398. if (res.code == 200) {
  399. this.$Message.success(res.msg);
  400. if ((this.gridOptions.data.length - order_number.length) == 0 && this.pageIndex != 1) {
  401. this.pageIndex--;
  402. }
  403. this.selectData = [];
  404. this.initData(this.proxyData);
  405. }
  406. })
  407. }
  408. })
  409. },
  410. handleSearch() {
  411. this.pageIndex = 1;
  412. this.proxyData = JSON.parse(JSON.stringify(this.searchData));
  413. this.proxyData.crt_time = [this.proxyData.crt_time[0] ? Date.parse(this.proxyData.crt_time[0]).toString().slice(0, 10) : '', this.proxyData.crt_time[1] ? (Date.parse(this.proxyData.crt_time[1])+86400000-1).toString().slice(0, 10) : '']
  414. this.proxyData.send_time = [this.proxyData.send_time[0] ? Date.parse(this.proxyData.send_time[0]).toString().slice(0, 10) : '', this.proxyData.send_time[1] ? (Date.parse(this.proxyData.send_time[1])+86400000-1).toString().slice(0, 10) : '']
  415. this.proxyData.upd_time = [this.proxyData.upd_time[0] ? Date.parse(this.proxyData.upd_time[0]).toString().slice(0, 10) : '', this.proxyData.upd_time[1] ? (Date.parse(this.proxyData.upd_time[1])+86400000-1).toString().slice(0, 10) : '']
  416. this.initData(this.proxyData);
  417. },
  418. initData(row) {
  419. this.axios.post('/api/materialOrderList', { ...row, page_size: this.pageSize, page_index: this.pageIndex }).then(res => {
  420. this.gridOptions.data = res.data.data;
  421. this.total = res.data.total;
  422. })
  423. },
  424. changePage(e) {
  425. this.pageIndex = e;
  426. this.initData(this.proxyData);
  427. },
  428. changeSize(e) {
  429. this.pageSize = e;
  430. this.pageIndex = 1;
  431. this.initData(this.proxyData);
  432. },
  433. }
  434. }
  435. </script>
  436. <style lang="scss" scoped>
  437. .form_item {
  438. margin-bottom: 15px !important;
  439. }
  440. .table_content {
  441. height: calc(100% - 150px);
  442. }
  443. </style>