index.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. <template>
  2. <div>
  3. <Modal fullscreen
  4. :title="title"
  5. v-model="show"
  6. @on-ok="then">
  7. <Topsearch ref="topsearch"
  8. :list="set_list"
  9. @init="init"
  10. @searchData="init">
  11. </Topsearch>
  12. <Table @on-selection-change="selectTableProject"
  13. :max-height="maxHeight"
  14. stripe
  15. border
  16. :columns="project_tableColumns"
  17. :data="project_tableData"></Table>
  18. <div ref="footercenter"
  19. class="footer-center">
  20. <Page :total="total"
  21. :current.sync="pageIndex"
  22. :show-total="true"
  23. :page-size="pageSize"
  24. :show-sizer="true"
  25. :show-elevator="true"
  26. @on-change="changePage"
  27. @on-page-size-change="changeSize">
  28. </Page>
  29. </div>
  30. <Topsearch ref="topsearch"
  31. :list="set_childrenList"
  32. :showbtn='set_childrenList.length>0?true:false'
  33. @searchData="childrenSearch"></Topsearch>
  34. <Table row-key="__index"
  35. @on-selection-change="selectTable"
  36. :max-height="maxHeight"
  37. stripe
  38. border
  39. v-if="type!=9"
  40. v-show="type!=14"
  41. :columns="parts_tableColumns"
  42. :data="parts_tableData">
  43. <template slot="purchases_num" slot-scope="{index}">
  44. <Input v-model="parts_tableData[index].purchases_num" ></Input>
  45. </template>
  46. </Table>
  47. <vxe-table resizable
  48. border
  49. size="mini"
  50. align="center"
  51. ref="xTree"
  52. v-else
  53. v-show="type!=14"
  54. highlight-hover-row
  55. :scroll-y="{enabled: false}"
  56. :scroll-x="{enabled: false}"
  57. :tree-config="{children: 'children',indent:10,line:true}"
  58. :data="parts_tableData"
  59. @toggle-tree-expand="toggleExpandChangeEvent"
  60. @checkbox-change="selectChangeEvent">
  61. <vxe-table-column field="laravel"
  62. title="展开"
  63. type="checkbox"
  64. tree-node
  65. min-width="50"></vxe-table-column>
  66. <vxe-table-column field="stock_type_title"
  67. title="存货分类名称"
  68. min-width="70"></vxe-table-column>
  69. <vxe-table-column field="code"
  70. title="存货编码"
  71. min-width="80"></vxe-table-column>
  72. <vxe-table-column field="title"
  73. title="存货名称"
  74. :edit-render="{enabled:false}"
  75. min-width="100">
  76. <template #default="{ row }">
  77. <vxe-button type="text"
  78. style="color:#606266">{{row.title}}</vxe-button>
  79. </template>
  80. </vxe-table-column>
  81. <vxe-table-column field="model"
  82. title="规格型号"
  83. min-width="20"></vxe-table-column>
  84. <vxe-table-column field="matching_number"
  85. title="配比数量"
  86. min-width="40"
  87. :edit-render="{enabled:false}"></vxe-table-column>
  88. <vxe-table-column field="number"
  89. title="数量"
  90. min-width="40"
  91. :edit-render="{enabled:false}">
  92. </vxe-table-column>
  93. <vxe-table-column field="unit"
  94. title="计量单位"
  95. min-width="20"></vxe-table-column>
  96. <vxe-table-column field="single"
  97. title="单重"
  98. min-width="20"></vxe-table-column>
  99. <vxe-table-column field="total_single"
  100. title="总重"
  101. min-width="20">
  102. <template #default="{ row }">
  103. <span>{{ countAmount(row) }} </span>
  104. </template>
  105. </vxe-table-column>
  106. <vxe-table-column field="img_number"
  107. title="工程图号"
  108. min-width="40"></vxe-table-column>
  109. <vxe-table-column field="attr"
  110. title="存货属性"
  111. width="180"
  112. :edit-render="{enabled:false,name: '$select', options: stockGoodsList, props: {multiple: true}}"></vxe-table-column>
  113. <vxe-table-column field="remark"
  114. title="备注"
  115. min-width="80"></vxe-table-column>
  116. </vxe-table>
  117. </Modal>
  118. </div>
  119. </template>
  120. <script>
  121. export default {
  122. data () {
  123. return {
  124. show: false,
  125. list: [],
  126. childrenList: [],
  127. stockGoodsList: [],
  128. project_tableColumns: [],
  129. project_tableData: [],
  130. parts_tableColumns: [],
  131. parts_tableData: [],
  132. total: 100,
  133. pageIndex: 1,
  134. pageSize: 10,
  135. maxHeight: null,
  136. proxyObj: {},
  137. get_project_url: '',
  138. params: {},
  139. childrenParams: {},
  140. get_child_url: '',
  141. tableResult: [],
  142. projectDetail: {},
  143. detailProxy: {},
  144. detailChangeProxy: {},
  145. supplierList: [{ label: "1", value: 1 }],
  146. childrenCheck: {},
  147. purchaseTypeList: [],
  148. materialTypeList: [],
  149. currencyOrder: null,
  150. plan_no_list:[],
  151. material:[],
  152. project_code:[],
  153. project_title:[],
  154. supply:[],
  155. plan_no:[],
  156. }
  157. },
  158. computed: {
  159. set_list () {
  160. switch (this.type) {
  161. case 1:
  162. return [//参照采购计划
  163. { title: '计划单号', name: 'Select', value: '', placeholder: '请选择计划单号', serverName: 'plan_no',option:this.plan_no_list },
  164. { title: '采购计划类型', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'plan_type', option: this.purchaseTypeList },
  165. { title: '单据日期', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', }
  166. ]
  167. case 2:
  168. case 3:
  169. case 5:
  170. return [//参照采购单
  171. { title: '订单号', name: 'Input', value: '', placeholder: '请输入订单号', serverName: 'purchase_order_no' },
  172. { title: '采购类型', name: 'Select', value: '', placeholder: '请选择采购类型', serverName: 'type_id', option: this.purchaseTypeList },
  173. { title: '项目名称', name: 'Input', value: '', placeholder: '请输入项目名称', serverName: 'client_name', },
  174. { title: '供应商名称', name: 'Input', value: '', placeholder: '请输入供应商名称', serverName: 'supply_title', },
  175. { title: '制单时间', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
  176. ]
  177. case 4:
  178. case 6:
  179. case 7:
  180. case 8:
  181. case 9:
  182. return [//参照质检单
  183. { title: '订单号', name: 'Input', value: '', placeholder: '请输入订单号', serverName: 'purchase_order_quality_no' },
  184. { title: '项目名称', name: 'Input', value: '', placeholder: '请输入项目名称', serverName: 'type_title', },
  185. { title: '制单时间', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
  186. ]
  187. }
  188. },
  189. set_childrenList () {
  190. switch (this.type) {
  191. case 1:
  192. return [//采购参照请购单
  193. { title: '物料分类', name: 'Select', value: '', placeholder: '请选择物料分类', serverName: 'material_type_id', option: this.materialTypeList },
  194. {title: '物料名称',name:'Select',value:'',placeholder:'请输入物料名称',serverName:'material_title',option:this.material},
  195. {title: '项目编码',name:'Select',value:'',placeholder:'请选择项目编码',serverName:'project_code',option:this.project_code},
  196. {title: '项目名称',name:'Select',value:'',placeholder:'请选择项目编码',serverName:'project_title',option:this.project_title},
  197. {title: '建议供应商',name:'Select',value:'',placeholder:'请选择项目编码',serverName:'supply_id',option:this.supply},
  198. { title: '预计到货时间', start_server: 'arrive_start_time', end_server: 'arrive_end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', }
  199. ]
  200. case 2:
  201. case 3:
  202. case 5:
  203. return [//到货参照采购单
  204. { title: '物料分类', name: 'Select', value: '', placeholder: '请选择物料分类', serverName: 'type_id', option: this.materialTypeList },
  205. { title: '物料名称', name: 'Input', value: '', placeholder: '请输入物料名称', serverName: 'title' },
  206. ]
  207. case 4:
  208. case 6:
  209. return [//质检参照到货单
  210. { title: '物料分类', name: 'Select', value: '', placeholder: '请选择物料分类', serverName: 'type_id', option: this.materialTypeList },
  211. { title: '物料名称', name: 'Input', value: '', placeholder: '请输入物料名称', serverName: 'title' },
  212. ]
  213. case 7:
  214. case 8:
  215. case 9:
  216. return [//参照质检单
  217. { title: '物料分类', name: 'Select', value: '', placeholder: '请选择物料分类', serverName: 'type_id', option: this.materialTypeList },
  218. { title: '物料名称', name: 'Input', value: '', placeholder: '请输入物料名称', serverName: 'title' },
  219. ]
  220. }
  221. }
  222. },
  223. watch: {},
  224. created () {
  225. this.axios({
  226. method: 'get',
  227. url: '/api/basics_material_index',
  228. }).then((res) => {
  229. this.materialTypeList = res.data.data
  230. this.materialTypeList.forEach(element => {
  231. element.label = element.title
  232. element.value = element.type_id
  233. });
  234. }).catch((err) => { });
  235. switch (this.type) {
  236. case 1: //采购订单参照采购计划
  237. this.project_tableColumns = [
  238. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  239. // { title: '订单号', align: 'center', key: 'purchase_order_apply_no', minWidth: 200, },
  240. { title: '计划单号', align: 'center', key: 'plan_no', minWidth: 200, },
  241. { title: '采购计划类型', align: 'center', key: 'plan_type_title', minWidth: 150, },
  242. {
  243. title: '单据日期', align: 'center', key: 'crt_time', minWidth: 200,
  244. render: (h, params) =>
  245. h('span', params.row.order_time?this.func.replaceDate(params.row.order_time * 1).split(' ')[0]:''),
  246. },
  247. { title: '备注', align: 'center', key: 'remark', minWidth: 150 }
  248. ]
  249. this.parts_tableColumns = [
  250. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  251. { title: '物料分类', key: 'material_type', align: 'center', minWidth: 150 },
  252. { title: '物料名称', key: 'material_title', align: 'center', minWidth: 150 },
  253. {
  254. title: '物料规格', key: '', align: 'center', minWidth: 150,
  255. render: (h, params) => {
  256. const { row } = params
  257. let text = `${row.long}*${row.width}*${row.high}`
  258. return h('span', {}, text)
  259. }
  260. },
  261. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  262. { title: '项目编码', key: 'project_code', align: 'center', minWidth: 150 },
  263. { title: '项目名称', key: 'project_title', align: 'center', minWidth: 150 },
  264. { title: '计划数量', key: 'num', align: 'center', minWidth: 150,
  265. render:(h,params)=>{
  266. const {row} = params;
  267. return h("span",{},row.num-row.reference_num)
  268. } },
  269. { title: '采购数量', key: 'purchases_num', align: 'center', minWidth: 150,slot:'purchases_num'
  270. // render:(h,params,index)=>{
  271. // console.log(index)
  272. // return h("Input",{props:{value:params.row.purchases_num},on:{'on-change':(e)=>{
  273. // console.log(index);
  274. // // this.parts_tableData[index].purchases_num=e.target.value;
  275. // console.log(this.parts_tableData)}}})
  276. // }
  277. },
  278. { title: '预计到货时间', key: 'arrived_time', align: 'center', minWidth: 150,
  279. render:(h,params)=>{
  280. const {row}=params;
  281. return h('span',{},row.arrive_time?this.func.replaceDate(row.arrive_time*1).split(' ')[0]:'')
  282. } },
  283. { title: '建议供应商', key: 'supply_title', align: 'center', minWidth: 150 },
  284. ]
  285. this.get_project_url = '/api/purchase_apply_list'
  286. this.get_child_url = '/api/purchase_apply_detail'
  287. this.childrenParams = {}
  288. break
  289. case 2: //到货单参照采购单
  290. this.project_tableColumns = [
  291. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  292. { title: '订单号', align: 'center', key: 'purchase_order_no', minWidth: 200, },
  293. { title: '采购类型', align: 'center', key: 'type_title', minWidth: 100, },
  294. { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 150 },
  295. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  296. {
  297. title: '预计到货', align: 'center', key: 'arrive_time', minWidth: 200,
  298. render: (h, params) =>
  299. h('span', this.func.replaceDate(params.row.arrive_time * 1)),
  300. },
  301. {
  302. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  303. render: (h, params) =>
  304. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  305. },
  306. ]
  307. this.parts_tableColumns = [
  308. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  309. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  310. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  311. {
  312. title: '物料规格', key: '', align: 'center', minWidth: 150,
  313. render: (h, params) => {
  314. const { row } = params
  315. let text = `${row.long}*${row.width}*${row.high}`
  316. return h('span', {}, text)
  317. }
  318. },
  319. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  320. { title: '采购数量', key: 'num', align: 'center', minWidth: 150 },
  321. ]
  322. this.get_project_url = '/api/purchase_list'
  323. this.get_child_url = '/api/purchase_refer'
  324. this.childrenParams = {}
  325. break
  326. case 3: //质检单参照采购单
  327. this.project_tableColumns = [
  328. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  329. { title: '订单号', align: 'center', key: 'purchase_order_no', minWidth: 200, },
  330. { title: '采购类型', align: 'center', key: 'type_title', minWidth: 100, },
  331. { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 150 },
  332. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  333. {
  334. title: '预计到货', align: 'center', key: 'arrive_time', minWidth: 200,
  335. render: (h, params) =>
  336. h('span', this.func.replaceDate(params.row.arrive_time * 1)),
  337. },
  338. {
  339. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  340. render: (h, params) =>
  341. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  342. },
  343. ]
  344. this.parts_tableColumns = [
  345. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  346. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  347. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  348. {
  349. title: '物料规格', key: '', align: 'center', minWidth: 150,
  350. render: (h, params) => {
  351. const { row } = params
  352. let text = `${row.long}*${row.width}*${row.high}`
  353. return h('span', {}, text)
  354. }
  355. },
  356. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  357. { title: '采购数量', key: 'num', align: 'center', minWidth: 150 },
  358. ]
  359. this.get_project_url = '/api/purchase_list'
  360. this.get_child_url = '/api/quality_refer'
  361. this.childrenParams = { type: this.refer_type }
  362. break
  363. case 4: //质检单参照到货单
  364. this.project_tableColumns = [
  365. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  366. { title: '订单号', align: 'center', key: 'purchase_order_arrive_no', minWidth: 200, },
  367. { title: '项目名称', align: 'center', key: 'type_title', minWidth: 150 },
  368. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  369. {
  370. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  371. render: (h, params) =>
  372. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  373. },
  374. ]
  375. this.parts_tableColumns = [
  376. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  377. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  378. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  379. {
  380. title: '物料规格', key: '', align: 'center', minWidth: 150,
  381. render: (h, params) => {
  382. const { row } = params
  383. let text = `${row.long}*${row.width}*${row.high}`
  384. return h('span', {}, text)
  385. }
  386. },
  387. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  388. { title: '到货数量', key: 'num', align: 'center', minWidth: 150 },
  389. ]
  390. this.get_project_url = '/api/purchase_arrive_list'
  391. this.get_child_url = '/api/quality_refer'
  392. this.childrenParams = { type: this.refer_type }
  393. break
  394. case 5: //入库单参照采购单
  395. this.project_tableColumns = [
  396. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  397. { title: '订单号', align: 'center', key: 'purchase_order_no', minWidth: 200, },
  398. { title: '采购类型', align: 'center', key: 'type_title', minWidth: 100, },
  399. { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 150 },
  400. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  401. {
  402. title: '预计到货', align: 'center', key: 'arrive_time', minWidth: 200,
  403. render: (h, params) =>
  404. h('span', this.func.replaceDate(params.row.arrive_time * 1)),
  405. },
  406. {
  407. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  408. render: (h, params) =>
  409. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  410. },
  411. ]
  412. this.parts_tableColumns = [
  413. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  414. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  415. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  416. {
  417. title: '物料规格', key: '', align: 'center', minWidth: 150,
  418. render: (h, params) => {
  419. const { row } = params
  420. let text = `${row.long}*${row.width}*${row.high}`
  421. return h('span', {}, text)
  422. }
  423. },
  424. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  425. { title: '采购数量', key: 'num', align: 'center', minWidth: 150 },
  426. ]
  427. this.get_project_url = '/api/purchase_list'
  428. this.get_child_url = '/api/warehouse_order_in_refer'
  429. this.childrenParams = { type: this.refer_type }
  430. break
  431. case 6: //入库单参照到货单
  432. this.project_tableColumns = [
  433. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  434. { title: '订单号', align: 'center', key: 'purchase_order_arrive_no', minWidth: 200, },
  435. { title: '项目名称', align: 'center', key: 'type_title', minWidth: 150 },
  436. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  437. {
  438. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  439. render: (h, params) =>
  440. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  441. },
  442. ]
  443. this.parts_tableColumns = [
  444. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  445. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  446. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  447. {
  448. title: '物料规格', key: '', align: 'center', minWidth: 150,
  449. render: (h, params) => {
  450. const { row } = params
  451. let text = `${row.long}*${row.width}*${row.high}`
  452. return h('span', {}, text)
  453. }
  454. },
  455. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  456. { title: '到货数量', key: 'num', align: 'center', minWidth: 150 },
  457. ]
  458. this.get_project_url = '/api/purchase_arrive_list'
  459. this.get_child_url = '/api/warehouse_order_in_refer'
  460. this.childrenParams = { type: this.refer_type }
  461. break
  462. case 7: //入库单参照质检单
  463. this.project_tableColumns = [
  464. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  465. { title: '订单号', align: 'center', key: 'purchase_order_quality_no', minWidth: 200, },
  466. { title: '项目名称', align: 'center', key: 'type_title', minWidth: 150 },
  467. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  468. {
  469. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  470. render: (h, params) =>
  471. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  472. },
  473. ]
  474. this.parts_tableColumns = [
  475. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  476. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  477. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  478. {
  479. title: '物料规格', key: '', align: 'center', minWidth: 150,
  480. render: (h, params) => {
  481. const { row } = params
  482. let text = `${row.long}*${row.width}*${row.high}`
  483. return h('span', {}, text)
  484. }
  485. },
  486. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  487. { title: '质检数量', key: 'num', align: 'center', minWidth: 150 },
  488. ]
  489. this.get_project_url = '/api/purchase_quality_list'
  490. this.get_child_url = '/api/warehouse_order_in_refer'
  491. this.childrenParams = { type: this.refer_type }
  492. break
  493. case 8: //出库单参照入库单
  494. this.project_tableColumns = [
  495. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  496. { title: '订单号', align: 'center', key: 'order_in_no', minWidth: 200, },
  497. { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 150 },
  498. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  499. { title: '操作员', align: 'center', key: 'nickname', minWidth: 100 },
  500. {
  501. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  502. render: (h, params) =>
  503. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  504. },
  505. ]
  506. this.parts_tableColumns = [
  507. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  508. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  509. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  510. {
  511. title: '物料规格', key: '', align: 'center', minWidth: 150,
  512. render: (h, params) => {
  513. const { row } = params
  514. let text = `${row.long}*${row.width}*${row.high}`
  515. return h('span', {}, text)
  516. }
  517. },
  518. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  519. { title: '派工数量', key: 'num', align: 'center', minWidth: 150 },
  520. ]
  521. this.get_project_url = '/api/warehouse_order_in_list'
  522. this.get_child_url = '/api/warehouse_order_out_refer'
  523. this.childrenParams = { type: this.refer_type }
  524. break
  525. case 9: //出库单参照派工单
  526. break
  527. case 15: //参照质检单
  528. this.list = [
  529. { title: '订单号', name: 'Input', value: '', placeholder: '请输入订单号', serverName: 'purchase_order_quality_no' },
  530. { title: '项目名称', name: 'Input', value: '', placeholder: '请输入项目名称', serverName: 'type_title', },
  531. { title: '制单时间', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
  532. ]
  533. this.project_tableColumns = [
  534. { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
  535. { title: '订单号', align: 'center', key: 'purchase_order_quality_no', minWidth: 200, },
  536. { title: '项目名称', align: 'center', key: 'type_title', minWidth: 150 },
  537. { title: '供应商名称', align: 'center', key: 'supply_title', minWidth: 150 },
  538. {
  539. title: '制单日期', align: 'center', key: 'crt_time', minWidth: 200,
  540. render: (h, params) =>
  541. h('span', this.func.replaceDate(params.row.crt_time * 1)),
  542. },
  543. ]
  544. this.parts_tableColumns = [
  545. { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
  546. { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
  547. { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
  548. {
  549. title: '物料规格', key: '', align: 'center', minWidth: 150,
  550. render: (h, params) => {
  551. const { row } = params
  552. let text = `${row.long}*${row.width}*${row.high}`
  553. return h('span', {}, text)
  554. }
  555. },
  556. { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
  557. { title: '质检数量', key: 'num', align: 'center', minWidth: 150 },
  558. ]
  559. this.get_project_url = '/api/purchase_quality_list'
  560. this.get_child_url = '/api/purchase_quality_detail'
  561. // this.childrenParams = { type: 3}
  562. break
  563. }
  564. },
  565. mounted () {
  566. let type_id = '';
  567. if(this.type ==1){
  568. type_id = 2
  569. }
  570. // 获取采购类型
  571. this.axios({ method: 'get', url: '/api/basic_purchase_list',params:{type_id} }).then((res) => {
  572. this.purchaseTypeList = res.data.data
  573. this.purchaseTypeList.forEach(element => {
  574. element.value = element.id
  575. element.label = element.title
  576. })
  577. }).catch((err) => { });
  578. this.$nextTick((e) => {
  579. const clientTableHeight = window.innerHeight - 51 - 57 -
  580. this.$refs['topsearch'].$el.clientHeight -
  581. this.$refs['footercenter'].clientHeight
  582. this.maxHeight = Math.floor(clientTableHeight / 2) - 20
  583. })
  584. },
  585. methods: {
  586. selectChangeEvent ({ records }) {
  587. this.tableResult = JSON.parse(JSON.stringify(records))
  588. },
  589. toggleExpandChangeEvent () { },
  590. countAmount (row) {
  591. return row.single * row.number
  592. },
  593. then () {
  594. this.$emit('then')
  595. },
  596. init (row) {
  597. row.page_index = 1
  598. row.page_size = this.pageSize
  599. let params = {
  600. ...this.params,
  601. ...row,
  602. sub_state: 1,
  603. }
  604. this.proxyObj = params
  605. this.parts_tableData = []
  606. this.getData(params)
  607. },
  608. childrenSearch (row) {
  609. switch (this.type) {
  610. case 1:
  611. row.plan_no = [];
  612. this.plan_no.forEach(v=>{
  613. row.plan_no.push(v)
  614. })
  615. row.arrive_end_time = parseInt(new Date(row.arrive_end_time).getTime() / 1000) || ''
  616. row.arrive_start_time= parseInt(new Date(row.arrive_start_time).getTime() / 1000) || ''
  617. break;
  618. case 2:
  619. row.purchase_order_no = this.currencyOrder
  620. break;
  621. case 3:
  622. case 4:
  623. case 5:
  624. case 6:
  625. case 7:
  626. case 8:
  627. case 9:
  628. row.refer_order_no = this.currencyOrder
  629. break;
  630. // case 3:
  631. // row.purchase_order_arrive_no = this.currencyOrder
  632. // break;
  633. // case 4:
  634. // row.purchase_order_quality_no = this.currencyOrder
  635. // break;
  636. }
  637. this.axios({
  638. method: 'post',
  639. url: this.get_child_url,
  640. data:{...row,
  641. reference_type: 1
  642. }
  643. } ).then((res) => {
  644. if (res.code == 200) {
  645. const deep_obj = JSON.parse(JSON.stringify(res.data))
  646. this.projectDetail = deep_obj
  647. this.parts_tableData = res.data.children
  648. }
  649. }).catch((err) => { });
  650. },
  651. getData (params) {
  652. params.end_time = Date.parse(params.end_time).toString().slice(0,10)
  653. params.start_time = Date.parse(params.start_time).toString().slice(0,10)
  654. params.reference_type =1;
  655. if(params.end_time == 'NaN'){
  656. params.end_time = ''
  657. }
  658. if(params.start_time == 'NaN'){
  659. params.start_time == ''
  660. }
  661. this.axios(this.get_project_url, { params: params }).then((res) => {
  662. if (res.code == 200) {
  663. res.data.data.map((v) => (v.check = false))
  664. this.project_tableData = res.data.data
  665. this.total = res.data.total
  666. this.plan_no_list = res.data.plan_no_list;
  667. let data = [];
  668. this.plan_no_list.forEach(v=>{
  669. let obj = {};
  670. obj.label = v;
  671. obj.value = v;
  672. data.push(obj)
  673. })
  674. this.plan_no_list = data;
  675. }
  676. })
  677. },
  678. renderRadio (h, params) {
  679. const { row, index } = params
  680. return h('Radio', {
  681. props: {
  682. value: row.check,
  683. },
  684. on: {
  685. 'on-change': (e) => {
  686. if (this.type != 14) {
  687. this.project_tableData.forEach((item) => (item.check = false))
  688. this.project_tableData[index].check = true
  689. this.childrenCheck = this.params
  690. this.childrenCheck.id = row.id
  691. this.childrenCheck.project_sub_id = row.project_sub_id
  692. this.changeRadio(this.project_tableData[index])
  693. } else {
  694. // console.log('this.project_tableData[index] :>> ', this.project_tableData[index]);
  695. this.tableResult = [this.project_tableData[index]]
  696. }
  697. },
  698. },
  699. })
  700. },
  701. changeRadio (row) {
  702. console.log('row :>> ', row);
  703. },
  704. changePage (e) {
  705. this.pageIndex = e
  706. this.proxyObj.page_index = this.pageIndex
  707. this.getData(this.proxyObj)
  708. },
  709. changeSize (e) {
  710. this.pageSize = e
  711. this.proxyObj.page_size = this.pageSize
  712. this.getData(this.proxyObj)
  713. },
  714. selectTable (result) {
  715. this.tableResult = result
  716. this.tableResult.forEach(element => {
  717. //入库参照//0未参照1参照采购单2参照到货单3参照质检
  718. //出库参照//0未参照1参照入库单2参照派工单
  719. switch (this.type) {
  720. case 5:
  721. element.type = 1
  722. break;
  723. case 6:
  724. element.type = 2
  725. break;
  726. case 7:
  727. element.type = 3
  728. break;
  729. case 8:
  730. element.type = 1
  731. break;
  732. case 9:
  733. element.type = 2
  734. break;
  735. default:
  736. break;
  737. }
  738. });
  739. },
  740. selectTableProject (selection) {
  741. switch (this.type) {
  742. case 1://采购单参照请购单
  743. console.log(selection);
  744. // this.currencyOrder = row.plan_no
  745. let plan_no = [];
  746. selection.forEach(v=>{
  747. plan_no.push(v.plan_no)
  748. })
  749. this.plan_no = plan_no;
  750. this.axios.post('/api/purchase_apply_detail_list',{plan_no}).then(res=>{
  751. this.material = res.data.material;
  752. this.material.forEach(v=>{
  753. v.label = v.title;
  754. v.value = v.title;
  755. })
  756. this.project_code = res.data.project_code;
  757. this.project_code.forEach(v=>{
  758. v.label = v.project_code;
  759. v.value = v.project_code;
  760. })
  761. this.project_title = res.data.project_title;
  762. this.project_title.forEach(v=>{
  763. v.label = v.project_title;
  764. v.value = v.project_title;
  765. })
  766. this.supply = res.data.supply;
  767. this.supply.forEach(v=>{
  768. v.label = v.title;
  769. v.value = v.id;
  770. })
  771. console.log(2)
  772. this.$forceUpdate();
  773. })
  774. this.axios({
  775. method: 'post',
  776. url: this.get_child_url,
  777. data: {
  778. plan_no
  779. }
  780. }).then((res) => {
  781. res.data.children.forEach(element => {
  782. // element.residential_name = row.residential_name;
  783. element.purchases_num = 0;
  784. })
  785. this.parts_tableData = res.data.children;
  786. }).catch((err) => { });
  787. break;
  788. case 2://到货单参照采购单
  789. this.currencyOrder = row.purchase_order_no
  790. this.axios({
  791. method: 'get',
  792. url: this.get_child_url,
  793. params: {
  794. purchase_order_no: row.purchase_order_no
  795. }
  796. }).then((res) => {
  797. this.parts_tableData = [...this.parts_tableData, ...res.data]
  798. }).catch((err) => { });
  799. break;
  800. case 3://质检单参照采购单
  801. this.currencyOrder = row.purchase_order_no
  802. this.axios({
  803. method: 'get',
  804. url: this.get_child_url,
  805. params: {
  806. refer_order_no: row.purchase_order_no,
  807. type: this.refer_type
  808. }
  809. }).then((res) => {
  810. this.parts_tableData = [...this.parts_tableData, ...res.data]
  811. }).catch((err) => { });
  812. break;
  813. case 4://质检单参照到货单
  814. this.currencyOrder = row.purchase_order_arrive_no
  815. this.axios({
  816. method: 'get',
  817. url: this.get_child_url,
  818. params: {
  819. refer_order_no: row.purchase_order_arrive_no,
  820. type: this.refer_type
  821. }
  822. }).then((res) => {
  823. this.parts_tableData = [...this.parts_tableData, ...res.data]
  824. }).catch((err) => { });
  825. break;
  826. case 5://入库单参照采购单
  827. this.currencyOrder = row.purchase_order_no
  828. this.axios({
  829. method: 'get',
  830. url: this.get_child_url,
  831. params: {
  832. refer_order_no: row.purchase_order_no,
  833. type: this.refer_type
  834. }
  835. }).then((res) => {
  836. this.parts_tableData = [...this.parts_tableData, ...res.data]
  837. }).catch((err) => { });
  838. break
  839. case 6://入库单参照到货单
  840. this.currencyOrder = row.purchase_order_arrive_no
  841. this.axios({
  842. method: 'get',
  843. url: this.get_child_url,
  844. params: {
  845. refer_order_no: row.purchase_order_arrive_no,
  846. type: this.refer_type
  847. }
  848. }).then((res) => {
  849. this.parts_tableData = [...this.parts_tableData, ...res.data]
  850. }).catch((err) => { });
  851. break
  852. case 7://入库单参照质检单
  853. this.currencyOrder = row.purchase_order_quality_no
  854. this.axios({
  855. method: 'get',
  856. url: this.get_child_url,
  857. params: {
  858. refer_order_no: row.purchase_order_quality_no,
  859. type: this.refer_type
  860. }
  861. }).then((res) => {
  862. this.parts_tableData = [...this.parts_tableData, ...res.data]
  863. }).catch((err) => { });
  864. break
  865. case 8://出库单参照入库单
  866. this.currencyOrder = row.order_in_no
  867. this.axios({
  868. method: 'get',
  869. url: this.get_child_url,
  870. params: {
  871. refer_order_no: row.order_in_no,
  872. type: this.refer_type
  873. }
  874. }).then((res) => {
  875. this.parts_tableData = [...this.parts_tableData, ...res.data]
  876. }).catch((err) => { });
  877. break
  878. default:
  879. break;
  880. }
  881. },
  882. },
  883. }
  884. </script>
  885. <style lang="scss" scoped>
  886. .footer-center {
  887. display: flex;
  888. justify-content: center;
  889. padding: 10px 0;
  890. }
  891. /deep/.ivu-table-fixed-body {
  892. padding-bottom: 20px;
  893. }
  894. </style>