detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div>
  3. <Toptitle title="板材统计表详情">
  4. <Button type="primary" style="margin-right: 10px" @click="checkTotal">查看合计</Button>
  5. <Button @click="AllSelect" style="margin-right: 10px" type="primary">{{state?'取消全选':'全选'}}</Button>
  6. <Button type="primary" ghost @click='exportData()' style="margin-right: 10px">导出</Button>
  7. <Button type="primary" @click="$router.go(-1)">返回</Button>
  8. </Toptitle>
  9. <Form :label-width='80' style="display:flex;flex-wrap:wrap;margin-top:15px">
  10. <FormItem label='图号'>
  11. <Select filterable multiple v-model="searchData.url_number" style="width:200px">
  12. <Option v-for="(item,index) in urlNumber_list" :key="index" :value="item" :label="item"></Option>
  13. </Select>
  14. </FormItem>
  15. <FormItem label='产品名称'>
  16. <Select filterable multiple v-model="searchData.product_id" style="width:200px">
  17. <Option v-for="(item,index) in product_list" :key="index" :value="item" :label="item"/>
  18. </Select>
  19. </FormItem>
  20. <FormItem label='派工时间'>
  21. <DatePicker type="date" placeholder="年/月/日" style="width: 200px" v-model="searchData.start_time"></DatePicker>~
  22. <DatePicker type="date" placeholder="年/月/日" style="width: 200px" v-model="searchData.end_time"></DatePicker>
  23. </FormItem>
  24. <FormItem><Button type="primary" @click="initData(searchData)">搜索</Button></FormItem>
  25. </Form>
  26. <div style="height:80%;overflow:auto">
  27. <Card v-for="(item,index) in infoNumber" :key="index">
  28. <div class="table_header">
  29. <div class="table_header_left">
  30. <Checkbox v-model="item.is_select" @on-change='itemSelect($event,item,index)'></Checkbox>
  31. <span>图号:{{item.url_number}}</span>
  32. <span>产品名称:{{item.product_title}}</span>
  33. <span>派工时间:{{item.crt_time?func.replaceDateNoHMS(item.crt_time):''}}</span>
  34. </div>
  35. <div class="table_header_right">
  36. <div @click="show(item,index)" style="cursor: pointer;"><span style="font-size:16px;">{{item.showType?'收缩':'展开'}}</span><Icon type="md-arrow-dropright" ref="ico" class="ico"/></div>
  37. <span>总计{{item.total}}条数据</span>
  38. </div>
  39. </div>
  40. <div v-if="item.showType">
  41. <div>
  42. <Form style="display:flex;" :label-width='80'>
  43. <FormItem label='物料分类:'>
  44. <Select v-model="underFormData.type_id" filterable multiple style="width:250px">
  45. <Option v-for="item in material_typeList" :key="item.id" :value="item.id" :label="item.title"/>
  46. </Select>
  47. </FormItem>
  48. <FormItem label='物料名称:'>
  49. <Select v-model="underFormData.material_title" filterable multiple style="width:250px">
  50. <Option v-for="val in materialList" :key="val.id" :value="val.title" :label="val.title"/>
  51. </Select>
  52. </FormItem>
  53. <FormItem><Button type="primary" @click="initUnderData(underFormData)">搜索</Button></FormItem>
  54. </Form>
  55. </div>
  56. <Table :columns="tableColumns" border :data="tableData" max-height="450">
  57. </Table>
  58. </div>
  59. </Card>
  60. </div>
  61. <Modal title="详情" width='50' v-model="show_total">
  62. <Form :label-width='100' class="modal_form">
  63. <FormItem label='物料分类:'>
  64. <Input placeholder="请输入物料分类" v-model="modalData.type_title" size="small" class="modal_item" clearable/>
  65. </FormItem>
  66. <FormItem label='物料名称:'>
  67. <Input placeholder="请输入物料名称" v-model="modalData.material_title" size="small" class="modal_item" clearable/>
  68. </FormItem>
  69. <FormItem :label-width='50'>
  70. <Button type="primary" size='small' @click="checkTotal(modalData)">搜索</Button>
  71. </FormItem>
  72. </Form>
  73. <Table :data='modalTableData' :columns='modalTableColumns' border max-height='550'>
  74. </Table>
  75. <div style="text-align:center;margin-top:20px">
  76. <Page :page-size-opts="[10, 20, 30, 40,100]"
  77. @on-page-size-change='changeSize'
  78. @on-change='changePage'
  79. :current='pageIndex'
  80. show-total
  81. :total="total"
  82. show-sizer
  83. :page-size='pageSize' />
  84. </div>
  85. <div slot="footer" style="text-align:center">
  86. <Button type="primary" @click="modalBack" style="width:200px">返回</Button>
  87. </div>
  88. </Modal>
  89. </div>
  90. </template>
  91. <script>
  92. export default {
  93. data(){
  94. return{
  95. proxyData:{},
  96. total:0,
  97. pageSize:10,
  98. pageIndex:1,
  99. modalTableData:[],
  100. modalTableColumns:[
  101. {type:'index',title:'序号',align:'center',minWidth:80},
  102. {title:'物料分类',key:'type_title',minWidth:100,align:'center'},
  103. {title:'物料名称',key:'material_title',minWidth:100,align:'center'},
  104. {title:'计量单位',key:'unit',minWidth:100,align:'center'},
  105. {title:'数量',key:'num',minWidth:100,align:'center'},
  106. ],
  107. modalData:{
  108. type_title:'',
  109. material_title:''
  110. },
  111. show_total:false,
  112. tableColumns:[
  113. {title:'序号',type:'index',align:'center',minWidth:60},
  114. {title:'物料分类',align:'center',minWidth:100,key:'type_title'},
  115. {title:'物料名称',align:'center',minWidth:150,key:'material_title'},
  116. // {title:'规格型号',align:'center',minWidth:150,key:'measure',render:(h,params)=>{
  117. // const {row} = params;
  118. // const text = `${row.long?row.long:0}*${row.wide?row.wide:0}*${row.thick?row.thick:0}`
  119. // return h('span',{},text)
  120. // }},
  121. {title:'原料尺寸',align:'center',minWidth:150,key:'storage_size'},
  122. {title:'计量单位',align:'center',minWidth:80,key:'unit'},
  123. {title:'精裁面积',align:'center',minWidth:150,key:'cut_area'},
  124. {title:'数量',align:'center',minWidth:80,key:'num'},
  125. ],
  126. tableData:[],
  127. selectData:[],
  128. infoNumber:[],
  129. underFormData:{
  130. type_id:[],
  131. material_title:[],
  132. },
  133. searchData:{
  134. url_number:[],
  135. product_id:[],
  136. start_time:'',
  137. end_time:''
  138. },
  139. material_typeList:[],
  140. materialList:[],
  141. urlNumber_list:[],
  142. product_list:[],
  143. url_number:'',
  144. state:false,
  145. }
  146. },
  147. created(){
  148. //获取物料分类
  149. this.axios.get('/api/basics_material_index').then(res => {
  150. this.material_typeList = res.data.data;
  151. }
  152. );
  153. //获取物料名称
  154. this.axios.get('/api/material').then(res=>{
  155. this.materialList = res.data.data;
  156. })
  157. },
  158. mounted(){
  159. this.initData();
  160. },
  161. methods:{
  162. modalBack(){
  163. this.show_total = false;
  164. this.modalData.type_title = '';
  165. this.modalData.material_title = '';
  166. },
  167. changePage(e){
  168. this.pageIndex = e;
  169. },
  170. changeSize(e){
  171. this.pageSize = e;
  172. this.pageIndex = 1;
  173. },
  174. checkTotal(data){
  175. if(this.selectData.length==0){
  176. return this.$Message.warning('请先选择图号!')
  177. }
  178. let url_number = [];
  179. this.selectData.forEach(v=>{
  180. url_number.push(v.url_number);
  181. })
  182. this.axios.post('/api/finance_quota_detail_material_total',{url_number,order_no:this.$route.query.order_no,...data}).then(res=>{
  183. if(res.code == 200){
  184. this.modalTableData = res.data.data;
  185. this.total = res.data.total;
  186. this.show_total = true;
  187. }
  188. })
  189. },
  190. itemSelect(e,item,index){
  191. console.log(e);
  192. if(e){
  193. this.selectData.push(item);
  194. this.infoNumber[index].is_select = true;
  195. let arr = this.infoNumber.filter(v=>{
  196. return v.is_select == false;
  197. })
  198. if(arr.length == 0){
  199. this.state = true;
  200. }
  201. }else{
  202. this.state = false;
  203. this.infoNumber[index].is_select = false;
  204. this.selectData.forEach((v,idx)=>{
  205. if(v.index == item.index){
  206. this.selectData.splice(idx,1)
  207. }
  208. })
  209. }
  210. },
  211. AllSelect(){
  212. if(this.state){
  213. this.infoNumber.forEach(v=>{
  214. v.is_select = false;
  215. this.state = false;
  216. })
  217. this.selectData = [];
  218. }else{
  219. this.infoNumber.forEach(v=>{
  220. v.is_select = true;
  221. this.state = true;
  222. })
  223. this.selectData = JSON.parse(JSON.stringify(this.infoNumber))
  224. }
  225. },
  226. async exportData(){
  227. // console.log(this.selectData);
  228. if(this.selectData.length==0){
  229. return this.$Message.warning('请先选择图号!')
  230. }
  231. let url_number = [];
  232. this.selectData.forEach(v=>{
  233. url_number.push(v.url_number);
  234. })
  235. const res = await this.axios.post('/api/finance_quota_export',{order_no:this.$route.query.order_no,url_number})
  236. if(res.code == 200){
  237. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`
  238. location.href = url
  239. }
  240. },
  241. initUnderData(row){
  242. this.axios.post('/api/finance_quota_detail_material',{order_no:this.$route.query.order_no,
  243. url_number:this.url_number,...row}).then(res=>{
  244. this.tableData = res.data.data;
  245. })
  246. },
  247. show(item,index){
  248. item.showType = !item.showType;
  249. this.infoNumber.forEach((v,indx)=>{
  250. if(indx!=index){
  251. v.showType = false;
  252. document.getElementsByClassName('ico')[index].style.transform = 'rotate(0deg)'
  253. }
  254. })
  255. if(item.showType){
  256. document.getElementsByClassName('ico')[index].style.transform = 'rotate(90deg)';
  257. this.url_number = item.url_number;
  258. this.underFormData={
  259. type_id:[],
  260. material_title:[],
  261. };
  262. this.initUnderData();
  263. }
  264. },
  265. initData(row){
  266. this.proxyData=row;
  267. let data = [];
  268. if(row){
  269. data = JSON.parse(JSON.stringify(row));
  270. data.end_time = row.end_time?Date.parse(row.end_time).toString().slice(0,10):'';
  271. data.start_time = row.start_time?Date.parse(row.start_time).toString().slice(0,10):'';
  272. }
  273. this.axios.post('/api/finance_quota_detail',{order_no:this.$route.query.order_no,...data}).then(res=>{
  274. res.data.data.forEach((v,index) => {
  275. v.showType = false;
  276. v.is_select=false;
  277. v.index = index;
  278. });
  279. this.infoNumber = res.data.data;
  280. this.urlNumber_list = res.data.url_number;
  281. this.product_list = res.data.product_title;
  282. })
  283. }
  284. }
  285. }
  286. </script>
  287. <style lang="scss" scoped>
  288. .table_header {
  289. display: flex;
  290. justify-content: space-between;
  291. .table_header_left{
  292. span{
  293. margin: 0 20px;
  294. }
  295. }
  296. .table_header_right {
  297. width: 240px;
  298. display: flex;
  299. justify-content: space-around;
  300. }
  301. }
  302. /deep/ .ivu-card{
  303. border-radius: 15px;
  304. margin: 15px 0;
  305. background: rgb(236, 236, 236);
  306. }
  307. .mate_info{
  308. display: flex;
  309. justify-content: space-between;
  310. margin: 20px 0;
  311. }
  312. .ico{
  313. height:14px;
  314. transition: all 0.4s;
  315. vertical-align: middle;
  316. }
  317. .modal_form{
  318. display: flex;
  319. flex-wrap: wrap;
  320. .modal_item{
  321. width: 150px;
  322. }
  323. }
  324. </style>