Dispatching.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. <template>
  2. <div>
  3. <Toptitle title="派工">
  4. <Button @click="goBack" type="primary" ghost style="margin-right:10px;"
  5. >返回</Button
  6. >
  7. <Button
  8. @click="handleGoPage"
  9. type="primary"
  10. ghost
  11. style="margin-right:10px;"
  12. >派工单查询</Button
  13. >
  14. <Button
  15. @click="handleDispatchConfirm"
  16. type="primary"
  17. style="margin-right:10px;"
  18. >确认派工</Button
  19. >
  20. </Toptitle>
  21. <div class="main">
  22. <Form style='display:flex;margin:15px 0;flex-wrap:wrap' :label-width='100'>
  23. <FormItem label='订单编号:' >
  24. <Select style="width:200px" v-model="searchData.order_no" filterable @on-change='orderNoChange' clearable>
  25. <Option :value="item" :label="item" v-for="(item,index) in orderList" :key="index"></Option>
  26. </Select>
  27. </FormItem>
  28. <FormItem label='项目名称:' >
  29. <Select style="width:200px" v-model="searchData.residential_name" filterable @on-change='residentialNameChange' clearable>
  30. <Option :value="item" :label="item" v-for="(item,index) in projectList" :key="index"></Option>
  31. </Select>
  32. </FormItem>
  33. <FormItem label='图号:'>
  34. <Tooltip placement='right' max-width='600' transfer>
  35. <Select style="width:200px" v-model="searchData.url_number" multiple filterable :disabled='show' :max-tag-count='1' >
  36. <Option value='全部' label="全部" @click.native="total_choose"></Option>
  37. <Option :value="item" :label="item" v-for="(item,index) in urlNumberList" :key="index"></Option>
  38. </Select>
  39. <div slot="content">
  40. {{searchData.url_number.toString()}}
  41. </div>
  42. </Tooltip>
  43. </FormItem>
  44. <FormItem label='区域:' >
  45. <Select style="width:200px" v-model="searchData.residential_name" filterable @on-change='residentialNameChange' clearable>
  46. <Option :value="item" :label="item" v-for="(item,index) in projectList" :key="index"></Option>
  47. </Select>
  48. </FormItem>
  49. <FormItem label='楼栋:' >
  50. <Select style="width:200px" v-model="searchData.residential_name" filterable @on-change='residentialNameChange' clearable>
  51. <Option :value="item" :label="item" v-for="(item,index) in projectList" :key="index"></Option>
  52. </Select>
  53. </FormItem>
  54. <FormItem label='单元:' >
  55. <Select style="width:200px" v-model="searchData.residential_name" filterable @on-change='residentialNameChange' clearable>
  56. <Option :value="item" :label="item" v-for="(item,index) in projectList" :key="index"></Option>
  57. </Select>
  58. </FormItem>
  59. <FormItem label='楼层:' >
  60. <Select style="width:200px" v-model="searchData.residential_name" filterable @on-change='residentialNameChange' clearable>
  61. <Option :value="item" :label="item" v-for="(item,index) in projectList" :key="index"></Option>
  62. </Select>
  63. </FormItem>
  64. <FormItem label='房间号:' >
  65. <Select style="width:200px" v-model="searchData.residential_name" filterable @on-change='residentialNameChange' clearable>
  66. <Option :value="item" :label="item" v-for="(item,index) in projectList" :key="index"></Option>
  67. </Select>
  68. </FormItem>
  69. <FormItem>
  70. <Button type="primary" @click="initDataSearch">搜索</Button>
  71. </FormItem>
  72. </Form>
  73. <div class="header">
  74. <Tabs v-model="currencyTag" @on-click="handleProcedureChange">
  75. <TabPane
  76. v-for="item in basicsProcedureList"
  77. :key="item.id"
  78. :label="item.title"
  79. :name="item.id + ''"
  80. />
  81. <div slot="extra" style="width:250px;line-height:40px;font-size:12px">
  82. <label style="width:130px">批量设置班组:</label>
  83. <Select v-model="group" size='small' style="z-index:99;position: fixed;width:150px;margin-top: 6px;margin-left:10px" @on-change='change_NK' clearable> <Option :value="_item.id" :label="_item.nickname" v-for="_item in groupList" :key="_item.id">
  84. </Option> </Select>
  85. </div>
  86. </Tabs>
  87. </div>
  88. <div class="content">
  89. <Table
  90. :columns="tableColumns"
  91. border
  92. max-height="700"
  93. @on-selection-change="handleSelectionChange"
  94. :data="tableData"
  95. ref="y_table"
  96. :loading='loading'
  97. >
  98. <template slot="slotGroup" slot-scope="{ row, index }">
  99. <Select
  100. v-model="row.employee_id"
  101. size="small"
  102. @on-change="
  103. (e) =>
  104. handleGroupSelect(
  105. e,
  106. tableData[index],
  107. index,
  108. tableData[index].employee_id
  109. )
  110. "
  111. clearable
  112. style="width: 150px"
  113. >
  114. <Option
  115. v-for="sitem in row.employee_list"
  116. :key="sitem.id"
  117. :label="sitem.nickname"
  118. :value="sitem.id"
  119. >
  120. </Option>
  121. </Select>
  122. </template>
  123. <template slot="slotSet" slot-scope="{ row, index }">
  124. <a style="margin:0 5px" @click="handleSet(row, index)">详情</a>
  125. <!-- <a style="margin:0 5px" @click="handleDispatchConfirm(row, index)"
  126. >派工</a
  127. > -->
  128. </template>
  129. </Table>
  130. </div>
  131. </div>
  132. <div class="pageSlotStyle">
  133. <Page :page-size-opts="[10, 20, 30, 40,100,1000]"
  134. @on-page-size-change='changeSize'
  135. @on-change='changePage'
  136. :current='page_index'
  137. show-total
  138. :total="total"
  139. show-sizer
  140. :page-size='page_size' />
  141. </div>
  142. <Modal v-model="showModal" title="确认派工">
  143. <Form :label-width="85" ref="forms" :model="dispatchInfo">
  144. <FormItem label="选择时间">
  145. <DatePicker
  146. :options="options"
  147. style="width:100%;"
  148. v-model="dispatchTime"
  149. clearable
  150. type="daterange"
  151. split-panels
  152. placeholder="请选择日期"
  153. ></DatePicker>
  154. </FormItem>
  155. <FormItem label="点工单形式">
  156. <RadioGroup v-model="dispatchInfo.work_type">
  157. <Radio :label="1">是</Radio>
  158. <Radio :label="0">否</Radio>
  159. </RadioGroup>
  160. </FormItem>
  161. <FormItem label="日薪" v-if="dispatchInfo.work_type == 1">
  162. <Input v-model="dispatchInfo.user_salary">
  163. <span slot="append">元</span>
  164. </Input>
  165. </FormItem>
  166. </Form>
  167. <div slot="footer">
  168. <Button @click="showModal = false">取消</Button>
  169. <Button type="primary" @click="handleDispatch(subArr, subUrl)"
  170. >确认</Button
  171. >
  172. </div>
  173. </Modal>
  174. <Modal v-model="showModalAll" title="全部派工">
  175. <Table
  176. :columns="modalTableColumns"
  177. border
  178. max-height="700"
  179. :data="modalTableData"
  180. >
  181. <template slot="slotGroup" slot-scope="{ row, index }">
  182. <Select
  183. v-model="row.employee_id"
  184. size="small"
  185. @on-change="
  186. (e) =>
  187. handleGroupSelect(
  188. e,
  189. modalTableData[index],
  190. index,
  191. modalTableData[index].employee_id
  192. )
  193. "
  194. clearable
  195. style="width: 120px"
  196. >
  197. <Option
  198. v-for="sitem in row.employee_list"
  199. :key="sitem.id"
  200. :label="sitem.nickname"
  201. :value="sitem.id"
  202. >
  203. </Option>
  204. </Select>
  205. </template>
  206. </Table>
  207. <div slot="footer">
  208. <Button @click="showModalAll = false">取消</Button>
  209. <Button type="primary" @click="handleDispatchAllConfirm">确认</Button>
  210. </div>
  211. </Modal>
  212. </div>
  213. </template>
  214. <script>
  215. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  216. // 例如:import 《组件名称》 from '《组件路径》';
  217. export default {
  218. name: "",
  219. components: {},
  220. props: {},
  221. // import引入的组件需要注入到对象中才能使用
  222. data() {
  223. // 这里存放数据
  224. return {
  225. loading:false,
  226. show:true,
  227. orderList:[],
  228. urlNumberList:[],
  229. projectList:[],
  230. tableColumns: [
  231. { title: '全选', type: 'selection', align: 'center', minWidth: 60 },
  232. { title: "工序", align: "center", key: "title", minWidth: 150 },
  233. { title: "图号", align: "center", key: "url_number", minWidth: 150 ,ellipsis:'true',tooltip:'true' },
  234. { title: "部件总数", align: "center", key: "num", minWidth: 150 },
  235. {
  236. title: "班组",
  237. align: "center",
  238. key: "",
  239. minWidth: 200,
  240. slot: "slotGroup",
  241. },
  242. { title: "区域", align: "center", key: "num", minWidth: 150 },
  243. { title: "楼栋", align: "center", key: "num", minWidth: 150 },
  244. { title: "单元", align: "center", key: "num", minWidth: 150 },
  245. { title: "楼层", align: "center", key: "num", minWidth: 150 },
  246. { title: "房间号", align: "center", key: "num", minWidth: 150 },
  247. {
  248. title: "操作",
  249. align: "center",
  250. key: "",
  251. minWidth: 100,
  252. slot: "slotSet",
  253. },
  254. ],
  255. modalTableColumns: [
  256. { title: "工序", align: "center", key: "title", minWidth: 150 },
  257. { title: "部件总数", align: "center", key: "num", minWidth: 150 },
  258. {
  259. title: "班组",
  260. align: "center",
  261. key: "",
  262. minWidth: 150,
  263. slot: "slotGroup",
  264. },
  265. ],
  266. modalTableData: [{}],
  267. tableData: [{}],
  268. page_index: 1,
  269. page_size: 10,
  270. total: 0,
  271. group:'',
  272. basicsProcedureList: [],
  273. groupList: [],
  274. currencyTag: "1",
  275. dispatchTime: [],
  276. wood_select:[],
  277. wood_group:'',
  278. paint_select:[],
  279. paint_group:'',
  280. packing_select:[],
  281. packing_group:'',
  282. transit_select:[],
  283. transit_group:'',
  284. install_select:[],
  285. install_group:'',
  286. selected: [],
  287. searchData:{
  288. order_no:'',
  289. url_number:[],
  290. residential_name:''
  291. },
  292. showModal: false,
  293. showModalAll: false,
  294. options: {
  295. disabledDate(date) {
  296. return date && date.valueOf() < Date.now() - 86400000;
  297. },
  298. },
  299. dispatchInfo: {},
  300. subArr: [],
  301. subUrl: "",
  302. show_type:true,
  303. url_number_type:true,
  304. };
  305. },
  306. // 生命周期 - 创建完成(可以访问当前this实例)
  307. created() {
  308. // 获取工序分类列表
  309. this.axios({ method: "get", url: "/api/basics_procedure_index" })
  310. .then((res) => {
  311. (this.basicsProcedureList = res.data.data),
  312. (this.currencyTag =
  313. localStorage.getItem("dispatchTag") || this.currencyTag + "");
  314. })
  315. .catch((err) => {});
  316. //获取班组列表
  317. this.axios("/api/employee_list").then(
  318. (res) => (this.groupList = res.data.data)
  319. );
  320. },
  321. // 生命周期 - 挂载完成(可以访问DOM元素)
  322. mounted() {
  323. this.initData();
  324. this.axios({
  325. method: "post",
  326. url: "/api/order_produce_list",
  327. data: {
  328. basics_procedure_id:
  329. localStorage.getItem("dispatchTag") || this.currencyTag,
  330. page_index:this.page_index,
  331. page_size:this.page_size,
  332. },
  333. }).then(res=>{
  334. this.orderList = res.data.order_no;
  335. this.projectList = res.data.residential_name;
  336. })
  337. },
  338. methods: {
  339. total_choose(){
  340. console.log(this.urlNumberList)
  341. if(this.searchData.url_number.indexOf('全部')>=0){
  342. this.searchData.url_number = JSON.parse(JSON.stringify(this.urlNumberList))
  343. this.searchData.url_number.unshift('全部')
  344. }else{
  345. this.searchData.url_number = [];
  346. }
  347. },
  348. initDataSearch(){
  349. if(this.searchData.residential_name&&this.searchData.order_no){
  350. this.url_number_type = false;
  351. this.initData();
  352. }else{
  353. this.url_number_type = true;
  354. this.initData();
  355. }
  356. },
  357. async residentialNameChange(val){
  358. await this.axios.get('/api/order_produce_order_no',{params:{residential_name:val}}).then(res=>{
  359. this.searchData.order_no = res.data.order_no
  360. })
  361. if(this.searchData.residential_name&&this.searchData.order_no){
  362. this.show = false;
  363. this.axios.get('/api/order_produce_url_number',{params:{...this.searchData,type_id:this.currencyTag}}).then(res=>{
  364. this.urlNumberList = res.data;
  365. this.searchData.url_number = [];
  366. this.wood_select=[]
  367. this.paint_select=[]
  368. this.packing_select=[]
  369. this.transit_select=[]
  370. this.install_select=[]
  371. })
  372. }else{
  373. this.show = true;
  374. if(this.show){
  375. this.searchData.url_number = []
  376. }
  377. }
  378. },
  379. async orderNoChange(val){
  380. await this.axios.get('/api/order_produce_order_no',{params:{order_no:val}}).then(res=>{
  381. this.searchData.residential_name = res.data.residential_name
  382. })
  383. if(this.searchData.residential_name&&this.searchData.order_no){
  384. this.show = false;
  385. this.axios.get('/api/order_produce_url_number',{params:{...this.searchData,type_id:this.currencyTag}}).then(res=>{
  386. this.urlNumberList = res.data;
  387. this.searchData.url_number = [];
  388. this.wood_select=[]
  389. this.paint_select=[]
  390. this.packing_select=[]
  391. this.transit_select=[]
  392. this.install_select=[]
  393. })
  394. }else{
  395. this.show =true;
  396. if(this.show){
  397. this.searchData.url_number = [];
  398. }
  399. }
  400. },
  401. change_NK(row){
  402. if(row == null){
  403. return
  404. }else{
  405. if(this.currencyTag == 1){
  406. if(this.wood_select.length == 0){
  407. this.$Message.warning('请先选择工序!');
  408. setTimeout(()=>{
  409. this.group = '';
  410. })
  411. }else{
  412. this.tableData.forEach(item=>{
  413. this.wood_select.forEach(_item=>{
  414. if(_item.id == item.id){
  415. item.employee_id = row;
  416. item._checked = true;
  417. _item.employee_id = row;
  418. }
  419. })
  420. })
  421. }
  422. }
  423. if(this.currencyTag == 2){
  424. if(this.paint_select.length == 0){
  425. this.$Message.warning('请先选择工序!');
  426. setTimeout(()=>{
  427. this.group = '';
  428. })
  429. }else{
  430. this.tableData.forEach(item=>{
  431. this.paint_select.forEach(_item=>{
  432. if(_item.id == item.id){
  433. item.employee_id = row;
  434. item._checked = true;
  435. _item.employee_id = row;
  436. }
  437. })
  438. })
  439. }
  440. }
  441. if(this.currencyTag == 3){
  442. if(this.packing_select.length == 0){
  443. this.$Message.warning('请先选择工序!');
  444. setTimeout(()=>{
  445. this.group = '';
  446. })
  447. }else{
  448. this.tableData.forEach(item=>{
  449. this.packing_select.forEach(_item=>{
  450. if(_item.id == item.id){
  451. item.employee_id = row;
  452. item._checked = true;
  453. _item.employee_id = row;
  454. }
  455. })
  456. })
  457. }
  458. }
  459. if(this.currencyTag == 4){
  460. if(this.transit_select.length == 0){
  461. this.$Message.warning('请先选择工序!');
  462. setTimeout(()=>{
  463. this.group = '';
  464. })
  465. }else{
  466. this.tableData.forEach(item=>{
  467. this.transit_select.forEach(_item=>{
  468. if(_item.id == item.id){
  469. item.employee_id = row;
  470. item._checked = true;
  471. _item.employee_id = row;
  472. }
  473. })
  474. })
  475. }
  476. }
  477. if(this.currencyTag == 5){
  478. if(this.install_select.length == 0){
  479. this.$Message.warning('请先选择工序!');
  480. setTimeout(()=>{
  481. this.group = '';
  482. })
  483. }else{
  484. this.tableData.forEach(item=>{
  485. this.install_select.forEach(_item=>{
  486. if(_item.id == item.id){
  487. item.employee_id = row;
  488. item._checked = true;
  489. _item.employee_id = row;
  490. }
  491. })
  492. })
  493. }
  494. }
  495. }
  496. },
  497. initData() {
  498. this.axios({
  499. method: "post",
  500. url: "/api/order_produce_list",
  501. data:{
  502. basics_procedure_id:
  503. localStorage.getItem("dispatchTag") || this.currencyTag,
  504. page_index:this.page_index,
  505. page_size:this.page_size,
  506. ...this.searchData
  507. },
  508. })
  509. .then((res) => {
  510. this.group = '';
  511. this.total = res.data.total;
  512. this.tableData = res.data.data;
  513. this.tableData.forEach((element) => {
  514. if(this.url_number_type){
  515. element.url_number = '';
  516. }
  517. element.produce_id = element.id;
  518. element.employee_id ? "" : (element.employee_id = "");
  519. if(this.currencyTag == 1 ){
  520. this.wood_select.forEach(_item=>{
  521. if(_item.id == element.id){
  522. element._checked = true;
  523. element.employee_id = _item.employee_id;
  524. }
  525. })
  526. }
  527. if(this.currencyTag == 2 ){
  528. this.paint_select.forEach(_item=>{
  529. if(_item.id == element.id){
  530. element._checked = true;
  531. element.employee_id = _item.employee_id;
  532. }
  533. })
  534. }
  535. if(this.currencyTag == 3 ){
  536. this.packing_select.forEach(_item=>{
  537. if(_item.id == element.id){
  538. element._checked = true;
  539. element.employee_id = _item.employee_id;
  540. }
  541. })
  542. }
  543. if(this.currencyTag == 4 ){
  544. this.transit_select.forEach(_item=>{
  545. if(_item.id == element.id){
  546. element._checked = true;
  547. element.employee_id = _item.employee_id;
  548. }
  549. })
  550. }
  551. if(this.currencyTag == 5 ){
  552. this.install_select.forEach(_item=>{
  553. if(_item.id == element.id){
  554. element._checked = true;
  555. element.employee_id = _item.employee_id;
  556. }
  557. })
  558. }
  559. });
  560. this.$forceUpdate();
  561. this.loading = false;
  562. })
  563. .catch((err) => {});
  564. },
  565. goBack() {
  566. this.$router.go(-1);
  567. },
  568. handleGoPage() {
  569. this.$router.push({ path: "/cms/Dispatching/DispatchedList" });
  570. },
  571. handleSet(row, index) {
  572. this.$router.push({
  573. path: "/cms/Dispatching/DispatchingDetail",
  574. query: {
  575. produce_id: row.id,
  576. },
  577. });
  578. },
  579. // handleDispatchConfirm(row, index) {
  580. // if (row.employee_id) {
  581. // this.selected = [row];
  582. // this.showModal = true;
  583. // this.subArr = JSON.parse(JSON.stringify(this.selected));
  584. // this.subUrl = "/api/order_produce_pull_all";
  585. // } else {
  586. // this.$Message.warning("请选择班组");
  587. // }
  588. // },
  589. handleDispatchConfirm() {
  590. if (this.wood_select.length!=0||this.paint_select.length!=0||this.packing_select.length!=0||this.transit_select.length!=0||this.install_select.length!=0) {
  591. this.show_type = true;
  592. this.subArr =[...this.wood_select,...this.paint_select,...this.packing_select,...this.transit_select,...this.install_select];
  593. console.log(this.subArr);
  594. this.subUrl = "/api/order_produce_pull_all";
  595. try{this.subArr.forEach(v=>{
  596. if(!v.employee_id){
  597. this.show_type = false;
  598. throw new Error();
  599. }
  600. })} catch(e){
  601. this.$Message.warning('请设置班组');
  602. };
  603. this.showModal = this.show_type;
  604. } else {
  605. this.$Message.warning("请选择工序");
  606. }
  607. },
  608. handleDispatch(target, url) {
  609. if (!this.dispatchTime[0]) {
  610. this.$Message.warning("请选择时间");
  611. } else {
  612. this.dispatchInfo.start_time = new Date(this.dispatchTime[0])
  613. .toLocaleDateString()
  614. .replace(/\//g, "-");
  615. this.dispatchInfo.end_time = new Date(this.dispatchTime[1])
  616. .toLocaleDateString()
  617. .replace(/\//g, "-");
  618. target.forEach((element) => {
  619. element.start_time = this.dispatchInfo.start_time;
  620. element.end_time = this.dispatchInfo.end_time;
  621. element.work_type = this.dispatchInfo.work_type;
  622. element.user_salary = this.dispatchInfo.user_salary || "";
  623. // element.order_no = this.searchData.order_no;
  624. // element.url_number = this.searchData.url_number;
  625. // element.residential_name = this.searchData.residential_name;
  626. });
  627. console.log(target);
  628. this.axios({
  629. method: "post",
  630. url,
  631. data: {
  632. ...target,
  633. ...this.searchData
  634. },
  635. })
  636. .then((res) => {
  637. if (res.code == 200) {
  638. this.showModal = false;
  639. this.$Message.success(res.msg || "操作成功");
  640. this.initData();
  641. this.dispatchInfo = {};
  642. this.dispatchTime = [];
  643. }
  644. })
  645. .catch((err) => {});
  646. }
  647. },
  648. handleDispatchAllConfirm() {
  649. let flag = true;
  650. this.modalTableData.forEach((element) => {
  651. if (!element.employee_id || element.employee_id <= 0) {
  652. flag = false;
  653. }
  654. });
  655. if (flag) {
  656. (this.showModalAll = false), (this.showModal = true);
  657. this.subArr = JSON.parse(JSON.stringify(this.modalTableData));
  658. this.subUrl = "/api/all_order_produce_pull";
  659. } else {
  660. this.$Message.warning("请选择班组");
  661. }
  662. },
  663. handleDispatchAllOpen() {
  664. this.axios
  665. .get("/api/get_all_order_produce", {
  666. params: {
  667. basics_procedure_id:
  668. localStorage.getItem("dispatchTag") | this.currencyTag,
  669. },
  670. })
  671. .then((res) => {
  672. if (res.code == 200) {
  673. this.modalTableData = res.data;
  674. this.modalTableData.forEach((element) => {
  675. element.produce_id = element.id;
  676. });
  677. this.showModalAll = true;
  678. }
  679. });
  680. },
  681. changePage(e) {
  682. this.page_index = e;
  683. this.initData();
  684. },
  685. changeSize(e) {
  686. this.page_size = e;
  687. this.initData();
  688. },
  689. handleProcedureChange(val) {
  690. this.loading = true;
  691. this.selected = [];
  692. this.currencyTag = val;
  693. localStorage.setItem("dispatchTag", val);
  694. this.axios.get('/api/order_produce_url_number',{params:{...this.searchData,type_id:this.currencyTag}}).then(res=>{
  695. this.urlNumberList = res.data;
  696. });
  697. this.searchData.url_number =[];
  698. this.initData();
  699. this.page_index = 1;
  700. this.page_size = 10;
  701. },
  702. handleSelectionChange(selection) {
  703. try{
  704. if(this.currencyTag == 1){
  705. this.wood_select = selection;
  706. this.wood_select.forEach((item,index)=>{
  707. if(this.wood_select[index].id!=this.tableData[index].id){
  708. this.$Message.error('请按流程选择工序!');
  709. throw new Error();
  710. }
  711. })
  712. }
  713. if(this.currencyTag == 2){
  714. this.paint_select =selection;
  715. this.paint_select.forEach((item,index)=>{
  716. if(this.paint_select[index].id!=this.tableData[index].id){
  717. this.$Message.error('请按流程选择工序!');
  718. throw new Error();
  719. }
  720. })
  721. }
  722. if(this.currencyTag == 3){
  723. this.packing_select =selection;
  724. this.packing_select.forEach((item,index)=>{
  725. if(this.packing_select[index].id!=this.tableData[index].id){
  726. this.$Message.error('请按流程选择工序!');
  727. throw new Error();
  728. }
  729. })
  730. }
  731. if(this.currencyTag == 4){
  732. this.transit_select = selection;
  733. this.transit_select.forEach((item,index)=>{
  734. if(this.transit_select[index].id!=this.tableData[index].id){
  735. this.$Message.error('请按流程选择工序!');
  736. throw new Error();
  737. }
  738. })
  739. }
  740. if(this.currencyTag == 5){
  741. this.install_select = selection;
  742. this.install_select.forEach((item,index)=>{
  743. if(this.install_select[index].id!=this.tableData[index].id){
  744. this.$Message.error('请按流程选择工序!');
  745. throw new Error();
  746. }
  747. })
  748. }
  749. }catch(e){
  750. }
  751. },
  752. handleGroupSelect(e, row, index, value) {
  753. // if (this.selected.length > 0) {
  754. // this.selected.forEach(element => {
  755. // if (element.id == row.id) {
  756. // element.employee_id = value
  757. // }
  758. // });
  759. // }
  760. row.employee_id = e;
  761. if(this.currencyTag == 1){
  762. this.tableData.forEach(item=>{
  763. this.wood_select.forEach(_item=>{
  764. if(item.id == _item.id){
  765. item._checked = true;
  766. _item.employee_id = item.employee_id;
  767. }
  768. })
  769. })
  770. }
  771. if(this.currencyTag == 2){
  772. this.tableData.forEach(item=>{
  773. this.paint_select.forEach(_item=>{
  774. if(item.id == _item.id){
  775. item._checked = true;
  776. _item.employee_id = item.employee_id;
  777. }
  778. })
  779. })
  780. }
  781. if(this.currencyTag == 3){
  782. this.tableData.forEach(item=>{
  783. this.packing_select.forEach(_item=>{
  784. if(item.id == _item.id){
  785. item._checked = true;
  786. _item.employee_id = item.employee_id;
  787. }
  788. })
  789. })
  790. }
  791. if(this.currencyTag == 4){
  792. this.tableData.forEach(item=>{
  793. this.transit_select.forEach(_item=>{
  794. if(item.id == _item.id){
  795. item._checked = true;
  796. _item.employee_id = item.employee_id;
  797. }
  798. })
  799. })
  800. }
  801. if(this.currencyTag == 5){
  802. this.tableData.forEach(item=>{
  803. this.install_select.forEach(_item=>{
  804. if(item.id == _item.id){
  805. item._checked = true;
  806. _item.employee_id = item.employee_id;
  807. }
  808. })
  809. })
  810. }
  811. },
  812. },
  813. // 监听属性 类似于data概念
  814. computed: {},
  815. // 监控data中的数据变化
  816. watch: {},
  817. beforeCreate() {}, // 生命周期 - 创建之前
  818. beforeMount() {}, // 生命周期 - 挂载之前
  819. beforeUpdate() {}, // 生命周期 - 更新之前
  820. updated() {}, // 生命周期 - 更新之后
  821. beforeDestroy() {}, // 生命周期 - 销毁之前
  822. destroyed() {}, // 生命周期 - 销毁完成
  823. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  824. };
  825. </script>
  826. <style lang="scss" scoped>
  827. .pageSlotStyle {
  828. display: flex;
  829. justify-content: center;
  830. margin-top: 50px;
  831. }
  832. /deep/ .ivu-table-wrapper {
  833. overflow: visible;
  834. }
  835. .main{
  836. height:600px;
  837. }
  838. </style>