newDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <div>
  3. <Toptitle :title="types==0?'详情':'编辑'">
  4. <Button @click="$router.go(-1)">返回</Button>
  5. <Upload
  6. :disabled='selectData.length==0'
  7. style="display: inline"
  8. name="your_file"
  9. :show-upload-list="false"
  10. accept='image'
  11. :headers="headers"
  12. :data='{order_no:$route.query.order_no,url_number:selectUrl}'
  13. :on-error="uploadError"
  14. :on-success="uploadSuccess"
  15. :action="$store.state.ip + '/api/deep_img_imports'"
  16. >
  17. <Button type="primary" style="margin-left: 10px" @click="()=>(selectData.length==0&&$Message.warning('请选择数据!'))"
  18. >导入图纸</Button
  19. >
  20. </Upload>
  21. </Toptitle>
  22. <Form :label-width='120' class="form_content">
  23. <FormItem label='下单编号:' class="form_item">
  24. <span>{{$route.query.order_number}}</span>
  25. </FormItem>
  26. <FormItem label='下单序号:' class="form_item">
  27. <span>{{$route.query.order_numbers}}</span>
  28. </FormItem>
  29. <FormItem label='深化导入日期:' class="form_item">
  30. <span>{{func.replaceDateNoHMS($route.query.crt_time)}}</span>
  31. </FormItem>
  32. </Form>
  33. <Form :label-width='100' class="form_content" style="border:none">
  34. <FormItem label='楼栋:'>
  35. <Select class="item" filterable clearable v-model="searchData.house">
  36. <Option v-for='(item,index) in houseList' :key="index" :value="item" :label="item"/>
  37. </Select>
  38. </FormItem>
  39. <FormItem label='单元:'>
  40. <Select class="item" filterable clearable v-model="searchData.unit">
  41. <Option v-for='(item,index) in unitList' :key="index" :value="item" :label="item"/>
  42. </Select>
  43. </FormItem>
  44. <FormItem label='楼层:'>
  45. <Select class="item" v-model="searchData.layer" filterable clearable>
  46. <Option v-for='(item,index) in layerList' :key="index" :value="item" :label="item"/>
  47. </Select>
  48. </FormItem>
  49. <FormItem label='房号:'>
  50. <Select class="item" v-model="searchData.number" filterable clearable>
  51. <Option v-for='(item,index) in numberList' :key="index" :value="item" :label="item"/>
  52. </Select>
  53. </FormItem>
  54. <FormItem label='房型:'>
  55. <Input class="item" placeholder="请输入房型" v-model="searchData.house_type" clearable/>
  56. </FormItem>
  57. <FormItem label='产品名称:'>
  58. <Input class="item" placeholder="请输入产品名称" v-model="searchData.product_title" clearable/>
  59. </FormItem>
  60. <FormItem label='左右:'>
  61. <Select class="item" v-model="searchData.fashion" filterable clearable>
  62. <Option :value="1" label='左'></Option>
  63. <Option :value="2" label='右'></Option>
  64. </Select>
  65. </FormItem>
  66. <FormItem label='图号:'>
  67. <Input class="item" placeholder="请输入图号" v-model="searchData.url_number" clearable/>
  68. </FormItem>
  69. <FormItem label='饰面:'>
  70. <Input class="item" placeholder="请输入饰面" v-model="searchData.process_property" clearable/>
  71. </FormItem>
  72. <FormItem :label-width='40'>
  73. <Button type="primary" @click="handleSearch">搜索</Button>
  74. </FormItem>
  75. </Form>
  76. <Tabs type="card" @on-click='handleTab'>
  77. <Button @click="handleTabsDel" size="small" slot="extra" v-show="type==='2'&&types==1" type="primary">批量删除</Button>
  78. <TabPane v-for="tab in 2" :key="tab" :label="tab==1?'汇总':'明细'" :name="tab+''">
  79. <Table :data='tab==1?tableData:totalTableData' :columns='tab==1?tableColumns:totalTableColumns' border max-height='450' @on-selection-change='handleSelect'>
  80. <template slot="set" slot-scope="{row}">
  81. <a @click="handleDel(row)">删除</a>
  82. </template>
  83. <template slot="img_url" slot-scope="{row}">
  84. <img v-show="row.img_url" @click="looks(row.img_url)" :src="$store.state.ip + row.img_url" alt="" class="img_content"/>
  85. <span v-show="!row.img_url"></span>
  86. </template>
  87. </Table>
  88. <div class="footerPage">
  89. <Page
  90. :page-size-opts="[10, 20, 30, 40, 100, 1000]"
  91. @on-page-size-change="(e)=>{tab==1?changeSize(e):totalChangeSize(e)}"
  92. @on-change="(e)=>{tab==1?changePage(e):totalChangePage(e)}"
  93. :current="tab==1?pageIndex:totalPageIndex"
  94. show-total
  95. :total="tab==1?total:totalTotal"
  96. show-sizer
  97. :page-size="tab==1?pageSize:totalPageSize"
  98. />
  99. </div>
  100. </TabPane>
  101. </Tabs>
  102. </div>
  103. </template>
  104. <script>
  105. export default {
  106. data(){
  107. return{
  108. selectUrl:[],
  109. headers: { Authorization: localStorage.getItem("token") },
  110. selectData:[],
  111. change_type:false,
  112. types:'',
  113. searchData:{
  114. house:'',
  115. unit:'',
  116. layer:'',
  117. number:'',
  118. house_type:'',
  119. product_title:"",
  120. fashion:'',
  121. url_number:'',
  122. process_property:''
  123. },
  124. houseList:[],
  125. unitList:[],
  126. layerList:[],
  127. numberList:[],
  128. proxyData:{},
  129. total:0,
  130. totalTotal:0,
  131. pageSize:10,
  132. pageIndex:1,
  133. totalPageSize:10,
  134. totalPageIndex:1,
  135. tableData:[],
  136. totalTableData:[],
  137. type:'',
  138. reTableColumns:[
  139. {type:'index',title:'序号',align:'center',minWidth:100},
  140. {title:'产品名称',align:'center',key:'product_title',minWidth:120},
  141. {title:'图号',align:'center',key:'url_number',minWidth:120},
  142. // {title:'规格',align:'center',key:'measure',minWidth:120},
  143. {title:'饰面',align:'center',key:'process_property',minWidth:120},
  144. {title:'数量',align:'center',key:'num',minWidth:120},
  145. {title:'图纸',align:'center',key:'img_url',minWidth:120,slot:'img_url'},
  146. ],
  147. tableColumns:[],
  148. totalTableColumns:[],
  149. reTotalTableColumns:[
  150. {type:'index',title:'序号',align:'center',minWidth:100},
  151. {title:'楼号',align:'center',key:'house',minWidth:120},
  152. {title:'单元',align:'center',key:'unit',minWidth:120},
  153. {title:'楼层',align:'center',key:'layer',minWidth:120},
  154. {title:'房号',align:'center',key:'number',minWidth:120},
  155. {title:'房型',align:'center',key:'house_type',minWidth:120},
  156. {title:'产品名称',align:'center',key:'product_title',minWidth:120},
  157. {title:'左右',align:'center',key:'fashion',minWidth:120,render:(h,params)=>{
  158. const {row} = params;
  159. return h('span',{},row.fashion==1?'左':row.fashion==2?'右':'')
  160. }},
  161. {title:'图号',align:'center',key:'url_number',minWidth:120},
  162. {title:'图纸',align:'center',key:'img_url',minWidth:120,slot:'img_url'},
  163. {title:'饰面',align:'center',key:'process_property',minWidth:120},
  164. {title:'规格',align:'center',key:'measure',minWidth:120},
  165. {title:'数量',align:'center',key:'num',minWidth:120},
  166. {title:'单位',align:'center',key:'units',minWidth:120},
  167. {title:'家具备注',align:'center',key:'remark',minWidth:120},
  168. ],
  169. }
  170. },
  171. created(){
  172. this.types=this.$route.query.type;
  173. this.change_type=this.$route.query.change_type;
  174. },
  175. mounted(){
  176. this.initData();
  177. },
  178. methods:{
  179. looks(img) {
  180. const array = [{ img_url: img }];
  181. this.$previewImg({
  182. list: array,
  183. baseUrl: this.$store.state.ip,
  184. baseImgField: "img_url",
  185. baseTitleField: "",
  186. showPrint:true
  187. });
  188. },
  189. uploadError(err) {
  190. this.$Message.error(err.msg || "上传失败");
  191. },
  192. //导入成功
  193. uploadSuccess(res) {
  194. if (res.code == 200) {
  195. this.$Message.success(res.msg || "上传成功");
  196. this.initData(this.proxyData)
  197. } else {
  198. this.$Message.warning(res.msg || "上传失败");
  199. }
  200. },
  201. handleSelect(e){
  202. console.log(e);
  203. this.selectData = e;
  204. this.selectUrl = [];
  205. e.forEach(v=>{
  206. this.selectUrl.push(v.url_number)
  207. })
  208. },
  209. handleTabsDel(){
  210. if(this.selectData.length==0){
  211. return this.$Message.warning('请先选择数据!')
  212. }
  213. let id =[];
  214. this.selectData.forEach(v=>{
  215. id.push(v.id);
  216. })
  217. this.confirmDelete({
  218. title:'删除',
  219. content:'确定删除?',
  220. then:()=>{
  221. this.axios.post('/api/deep_del',{id}).then(res=>{
  222. if(res.code==200){
  223. this.$Message.success(res.msg);
  224. if(this.totalTableData.length==this.selectData.length&&this.pageIndex!=1){
  225. this.pageIndex--;
  226. }
  227. this.totalInitData(this.proxyData)
  228. }
  229. })
  230. }
  231. })
  232. },
  233. handleDel(row){
  234. this.confirmDelete({
  235. title:'删除',
  236. content:'确定删除?',
  237. then:()=>{
  238. this.axios.post('/api/deep_del',{id:[row.id]}).then(res=>{
  239. if(res.code==200){
  240. this.$Message.success(res.msg);
  241. if(this.totalTableData.length==1&&this.pageIndex!=1){
  242. this.pageIndex--;
  243. }
  244. this.totalInitData(this.proxyData)
  245. }
  246. })
  247. }
  248. })
  249. },
  250. handleSearch(){
  251. let obj = JSON.parse(JSON.stringify(this.searchData));
  252. this.proxyData = obj;
  253. if(this.type==='1'){
  254. this.initData(this.proxyData);
  255. }else{
  256. this.totalInitData(this.proxyData);
  257. }
  258. },
  259. handleTab(name){
  260. this.type = name;
  261. if(name==='1'){
  262. console.log(typeof name)
  263. this.initData(this.proxyData);
  264. }else{
  265. this.totalInitData(this.proxyData);
  266. }
  267. },
  268. initData(row){
  269. this.axios.post('/api/deep_details',{order_no:this.$route.query.order_no,order_number:this.$route.query.order_number,order_numbers:this.$route.query.order_numbers,...row,type:1,page_size:this.pageSize,page_index:this.pageIndex}).then(res=>{
  270. this.tableData = res.data.data;
  271. if(this.change_type){
  272. // let columns=[];
  273. // columns = [...this.reTableColumns,{title:'下拆单状态',align:'center',minWidth:120,key:'state',render:(h,params)=>{
  274. // const {row} = params;
  275. // return h('span',{},row.split_state==0?'未下拆单':'已下拆单')
  276. // }}]
  277. this.tableColumns = [{type:'selection',align:'center',minWidth:80},...this.reTableColumns];
  278. }else{
  279. this.tableColumns = this.reTableColumns;
  280. }
  281. this.total = res.data.total;
  282. this.houseList=res.data.house;
  283. this.unitList=res.data.unit;
  284. this.layerList = res.data.layer;
  285. this.numberList = res.data.number
  286. })
  287. },
  288. totalInitData(row){
  289. this.axios.post('/api/deep_details',{order_no:this.$route.query.order_no,order_number:this.$route.query.order_number,order_numbers:this.$route.query.order_numbers,...row,type:2,page_size:this.totalPageSize,page_index:this.totalPageIndex}).then(res=>{
  290. this.totalTableData = res.data.data;
  291. if(this.change_type){
  292. let columns=[];
  293. if(this.types==0){
  294. columns = [...this.reTotalTableColumns,{title:'下拆单状态',align:'center',minWidth:120,key:'state',render:(h,params)=>{
  295. const {row} = params;
  296. return h('span',{},row.split_state==0?'未下拆单':'已下拆单')
  297. }}
  298. ]
  299. this.totalTableColumns = columns;
  300. }else{
  301. columns = [
  302. {type:'selection',align:'center',minWidth:100},...this.reTotalTableColumns,{title:'下拆单状态',align:'center',minWidth:120,key:'state',render:(h,params)=>{
  303. const {row} = params;
  304. return h('span',{},row.split_state==0?'未下拆单':'已下拆单')
  305. }},{title:'操作',align:'center',minWidth:100,slot:'set'}
  306. ]
  307. this.totalTableColumns = columns;
  308. }
  309. }else{
  310. this.totalTableColumns = this.reTotalTableColumns;
  311. }
  312. this.totalTotal = res.data.total;
  313. })
  314. },
  315. changeSize(e){
  316. this.pageSize = e;
  317. this.pageIndex = 1;
  318. this.initData(this.proxyData);
  319. },
  320. changePage(e){
  321. console.log(111);
  322. this.pageIndex = e;
  323. this.initData(this.proxyData);
  324. },
  325. totalChangeSize(e){
  326. this.totalPageSize=e;
  327. this.totalPageIndex =1;
  328. this.totalInitData(this.proxyData);
  329. },
  330. totalChangePage(e){
  331. console.log(11)
  332. this.totalPageIndex = e;
  333. this.totalInitData(this.proxyData);
  334. }
  335. }
  336. }
  337. </script>
  338. <style lang="scss" scoped>
  339. .form_content{
  340. margin-top: 10px;
  341. display: flex;
  342. flex-wrap: wrap;
  343. border-bottom: 1px solid gainsboro;
  344. .form_item{
  345. width: 250px;
  346. }
  347. .item{
  348. width:200px;
  349. }
  350. }
  351. .footerPage{
  352. margin-top: 10px;
  353. text-align: center;
  354. }
  355. .img_content{
  356. width:18px;
  357. height: 18px;
  358. }
  359. </style>