index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. <template>
  2. <div class="addStore pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. 123{{}}
  7. <el-form
  8. ref="ruleForm"
  9. :model="ruleForm"
  10. status-icon
  11. :rules="rulesThis"
  12. label-width="100px"
  13. class="demo-ruleForm"
  14. v-if="addId === 'add'"
  15. >
  16. <el-divider content-position="center">仓库信息:</el-divider>
  17. <el-row>
  18. <el-col :span="12"
  19. ><el-form-item
  20. label="所属公司"
  21. prop="storeToCompany"
  22. style="width: 100%"
  23. >
  24. <CompanySearch @searchCard="getCompanyName"></CompanySearch>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="12">
  28. <el-form-item label="仓库名称" prop="stockName">
  29. <el-input
  30. placeholder="请输入仓库名称"
  31. filterable
  32. clearable
  33. v-model="ruleForm.stockName"
  34. @change="getValue1"
  35. >
  36. </el-input>
  37. </el-form-item>
  38. </el-col>
  39. </el-row>
  40. <el-row>
  41. <el-col :span="12">
  42. <!-- 省/市/区选择组件 -->
  43. <el-form-item label="省/市/区" prop="stockToArea">
  44. <AreaSelect @areaSelect="areaSelect"></AreaSelect>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="12"
  48. ><!-- 仓库详细地址 -->
  49. <el-form-item label="详细地址" prop="stockDetail">
  50. <el-input
  51. placeholder="请输入内容"
  52. v-model="ruleForm.stockDetail"
  53. clearable
  54. @change="stockDetail"
  55. >
  56. </el-input>
  57. </el-form-item>
  58. </el-col>
  59. </el-row>
  60. <el-row>
  61. <el-col :span="12">
  62. <el-form-item label="负责人" prop="stockDutyer" style="width: 100%">
  63. <el-select
  64. style="width: 100%"
  65. v-model="ruleForm.stockDutyer"
  66. placeholder="请选择仓库负责人"
  67. @change="getValue2"
  68. >
  69. <el-option
  70. v-for="(item, index) in ruleForm.stockDutyer_options"
  71. :key="index"
  72. :label="item.nickname"
  73. :value="item.nickname"
  74. >
  75. <span style="float: left">{{ item.nickname }}</span>
  76. <span style="float: right; color: #8492a6; font-size: 13px">{{
  77. item.role_name
  78. }}</span>
  79. </el-option>
  80. </el-select>
  81. </el-form-item></el-col
  82. >
  83. <el-col :span="12">
  84. <el-form-item label="负责人电话" prop="dutyer_mobile">
  85. <el-input
  86. type="number"
  87. placeholder="请输入联系人电话"
  88. v-model="ruleForm.dutyer_mobile"
  89. clearable
  90. >
  91. </el-input> </el-form-item
  92. ></el-col>
  93. </el-row>
  94. <el-divider content-position="center">收发货信息:</el-divider>
  95. <!-- 收发货联系信息 -->
  96. <el-row>
  97. <el-col :span="12"
  98. ><!-- 收发货联系人 -->
  99. <el-form-item label="联系人" prop="linker">
  100. <el-input
  101. placeholder="请填写联系人"
  102. v-model="ruleForm.linker"
  103. clearable
  104. @change="linker"
  105. >
  106. </el-input> </el-form-item
  107. ></el-col>
  108. <el-col :span="12">
  109. <!-- 联系人电话 -->
  110. <el-form-item label="电话" prop="linker_mobile">
  111. <el-input
  112. type="number"
  113. placeholder="请输入联系人电话"
  114. v-model="ruleForm.linker_mobile"
  115. clearable
  116. @change="linkerMobile"
  117. >
  118. </el-input> </el-form-item
  119. ></el-col>
  120. </el-row>
  121. <el-row>
  122. <el-col :span="12">
  123. <!-- 收发货地址 -->
  124. <el-form-item label="省/市/区" prop="linker_addr">
  125. <AreaSelect @areaSelect="selectArea"></AreaSelect> </el-form-item
  126. ></el-col>
  127. <el-col :span="12">
  128. <!-- 收发货详细地址 -->
  129. <el-form-item label="详细地址" prop="linker_detail">
  130. <el-input
  131. placeholder="请输入详细地址"
  132. v-model="ruleForm.linker_detail"
  133. clearable
  134. @change="linkerDetail"
  135. >
  136. </el-input> </el-form-item
  137. ></el-col>
  138. </el-row>
  139. </el-form>
  140. <!-- 仓库详情 -->
  141. <el-form
  142. ref="ruleForm"
  143. :disabled="addId === 'detail'"
  144. :model="ruleForm"
  145. status-icon
  146. :rules="rulesThis"
  147. label-width="100px"
  148. class="demo-ruleForm"
  149. v-if="addId === 'detail'"
  150. >
  151. <el-divider content-position="center">仓库信息:</el-divider>
  152. <el-row>
  153. <el-col :span="12"
  154. ><el-form-item label="所属公司" prop="storeToCompany">
  155. <el-cascader
  156. placeholder="请选择所属公司"
  157. filterable
  158. clearable
  159. style="width: 100%"
  160. v-model="ruleForm.storeToCompany"
  161. :options="ruleForm.selectStock_go_options"
  162. @change="getValue"
  163. ></el-cascader>
  164. </el-form-item>
  165. </el-col>
  166. <el-col :span="12">
  167. <el-form-item label="仓库名称" prop="stockName">
  168. <el-input
  169. placeholder="请输入仓库名称"
  170. filterable
  171. clearable
  172. v-model="ruleForm.stockName"
  173. @change="getValue1"
  174. >
  175. </el-input>
  176. </el-form-item>
  177. </el-col>
  178. </el-row>
  179. <el-row>
  180. <el-col :span="12">
  181. <!-- 省/市/区选择组件 -->
  182. <el-form-item label="省/市/区" prop="stockToArea">
  183. <AreaSelect @areaSelect="areaSelect"></AreaSelect>
  184. </el-form-item>
  185. </el-col>
  186. <el-col :span="12"
  187. ><!-- 仓库详细地址 -->
  188. <el-form-item label="详细地址" prop="stockDetail">
  189. <el-input
  190. placeholder="请输入内容"
  191. v-model="ruleForm.stockDetail"
  192. clearable
  193. @change="stockDetail"
  194. >
  195. </el-input>
  196. </el-form-item>
  197. </el-col>
  198. </el-row>
  199. <el-form-item label="负责人" prop="stockDutyer" style="width: 50%">
  200. <el-select
  201. style="width: 100%"
  202. v-model="ruleForm.stockDutyer"
  203. placeholder="请选择仓库负责人"
  204. >
  205. <el-option
  206. v-for="item in ruleForm.stockDutyer_options"
  207. :key="item.id"
  208. :label="item.nickname"
  209. :value="item.id"
  210. >
  211. {{ item }}
  212. <!-- <span style="float: left">{{ item.nickname }}</span>
  213. <span style="float: right; color: #8492a6; font-size: 13px">{{
  214. item.role_name
  215. }}</span> -->
  216. </el-option>
  217. </el-select>
  218. </el-form-item>
  219. <el-divider content-position="center">收发货信息:</el-divider>
  220. <!-- 收发货联系信息 -->
  221. <el-row>
  222. <el-col :span="12"
  223. ><!-- 收发货联系人 -->
  224. <el-form-item label="联系人" prop="linker">
  225. <el-input
  226. placeholder="请填写联系人"
  227. v-model="ruleForm.linker"
  228. clearable
  229. @change="linker"
  230. >
  231. </el-input> </el-form-item
  232. ></el-col>
  233. <el-col :span="12">
  234. <!-- 联系人电话 -->
  235. <el-form-item label="电话" prop="linker_mobile">
  236. <el-input
  237. type="number"
  238. placeholder="请输入联系人电话"
  239. v-model="ruleForm.linker_mobile"
  240. clearable
  241. @change="linkerMobile"
  242. >
  243. </el-input> </el-form-item
  244. ></el-col>
  245. </el-row>
  246. <el-row>
  247. <el-col :span="12">
  248. <!-- 收发货地址 -->
  249. <el-form-item label="省/市/区" prop="linker_addr">
  250. <AreaSelect @areaSelect="selectArea"></AreaSelect> </el-form-item
  251. ></el-col>
  252. <el-col :span="12">
  253. <!-- 收发货详细地址 -->
  254. <el-form-item label="详细地址" prop="linker_detail">
  255. <el-input
  256. placeholder="请输入详细地址"
  257. v-model="ruleForm.linker_detail"
  258. clearable
  259. @change="linkerDetail"
  260. >
  261. </el-input> </el-form-item
  262. ></el-col>
  263. </el-row>
  264. </el-form>
  265. <el-col :span="24" style="text-align: right">
  266. <el-button
  267. v-if="addId === 'add'"
  268. type="primary"
  269. @click="submitForm('ruleForm')"
  270. >保 存
  271. </el-button>
  272. <el-button @click="showModelThis = false">{{
  273. isDetail ? "关 闭" : "取 消"
  274. }}</el-button>
  275. </el-col>
  276. </div>
  277. <div v-else>
  278. <no-auth></no-auth>
  279. </div>
  280. </div>
  281. </template>
  282. <script>
  283. import asyncRequest from "@/apis/service/purchaseIn/addStore";
  284. // import resToken from "@/mixins/resToken";
  285. import mixinPage from "@/mixins/elPaginationHandle";
  286. import resToken from "@/mixins/resToken";
  287. // import statusList from "@/assets/js/statusList";
  288. import addEdit from "./addEdit";
  289. import { mapGetters } from "vuex";
  290. import { isMobile } from "@/utils/validate";
  291. export default {
  292. name: "addStore",
  293. // props: ["showModel", "id", "isDetail", "sitem"],
  294. // mixins: [resToken],
  295. mixins: [mixinPage, resToken],
  296. components: {
  297. addEdit,
  298. },
  299. computed: {
  300. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  301. powers() {
  302. let tran =
  303. this.$store.getters.btnList.find(
  304. (item) => item.menu_route == "addStore"
  305. ) || {};
  306. if (tran && tran.action && tran.action.length > 0) {
  307. return tran.action;
  308. } else {
  309. return [];
  310. }
  311. },
  312. },
  313. data() {
  314. const validatemobile = (rule, value, callback) => {
  315. if (value === "") {
  316. callback(new Error("手机号不能为空!"));
  317. } else {
  318. if (!isMobile(value)) {
  319. callback(new Error("手机号格式不正确!"));
  320. } else {
  321. callback();
  322. }
  323. }
  324. };
  325. return {
  326. stockDutyer: "", //仓库负责人
  327. // addId: this.$route.query.id,
  328. addId: "",
  329. // route: this.$route,
  330. roleList: [],
  331. loading: false,
  332. title: "添加账号",
  333. organizeList: [],
  334. showModelThis: this.showModel,
  335. //省市区接口入参
  336. addr_code: {
  337. provice_code: "",
  338. city_code: "",
  339. area_code: "",
  340. },
  341. ruleForm: {
  342. storeToCompany: "",
  343. selectStock_go: "", //公司
  344. stockName: "", //仓库名称
  345. stockDutyer: "", //仓库负责人
  346. dutyer_mobile: "",
  347. linker: "", //收发货联系人
  348. linker_mobile: "", //收发货人联系电话
  349. linker_detail: "",
  350. // linker_addr: [], //收发货地址
  351. // stockDutyer_options: [], //仓库负责人列表
  352. // stockDetail: [], //仓库详细地址
  353. // selectStock_go_options: [], //公司列表
  354. // stockToArea: [],
  355. }, //
  356. rulesThis: this.rules,
  357. rules: {
  358. storeToCompany: [
  359. {
  360. // type: "array",
  361. required: true,
  362. message: "请选择仓库所在公司",
  363. trigger: "blur",
  364. // trigger: "change",
  365. },
  366. ],
  367. stockName: [
  368. {
  369. required: true,
  370. message: "请输入仓库名称",
  371. trigger: "blur",
  372. },
  373. ],
  374. stockDutyer: [
  375. {
  376. // type: "array",
  377. required: true,
  378. message: "请选择仓库负责人",
  379. // trigger: "change",
  380. trigger: "blur",
  381. },
  382. ],
  383. stockToArea: [
  384. {
  385. type: "array",
  386. required: true,
  387. message: "请选择仓库所在地址",
  388. trigger: "change",
  389. },
  390. ],
  391. stockDetail: [
  392. {
  393. required: true,
  394. message: "请选择仓库详细地址",
  395. trigger: "blur",
  396. },
  397. ],
  398. linker: [
  399. {
  400. required: true,
  401. message: "请填写收发货联系人",
  402. trigger: "blur",
  403. },
  404. ],
  405. linker_mobile: [
  406. {
  407. required: true,
  408. trigger: "blur",
  409. validator: validatemobile,
  410. },
  411. ],
  412. dutyer_mobile: [
  413. {
  414. required: true,
  415. trigger: "blur",
  416. validator: validatemobile,
  417. },
  418. ],
  419. linker_addr: [
  420. {
  421. type: "array",
  422. required: true,
  423. message: "请填写收发货联系人地址",
  424. trigger: "change",
  425. },
  426. ],
  427. linker_detail: [
  428. {
  429. required: true,
  430. message: "请输入详细地址",
  431. trigger: "blur",
  432. },
  433. ],
  434. },
  435. parmValue: {
  436. //入参
  437. name: "", //仓库名称
  438. supplierNo: "", //供应商编码
  439. wsmtype: 1, //仓库类型
  440. addr: "", //仓库地址
  441. contactor: "", //仓库联系人
  442. mobile: "", //仓库联系方式
  443. position: "", //联系人职位
  444. wsm_name: "", // 收发货联系人
  445. wsm_mobile: "", //收发货联系方式
  446. addr_code: {
  447. provice_code: "",
  448. city_code: "",
  449. area_code: "",
  450. },
  451. wsm_addr: "", //地址详细
  452. },
  453. };
  454. },
  455. watch: {
  456. $route: function (val, old) {
  457. this.addId = val.query.id;
  458. },
  459. },
  460. mounted() {
  461. this.addId = this.$route.query.id;
  462. this.getCompany();
  463. this.initForm();
  464. },
  465. methods: {
  466. // 获取公司列表
  467. getCompanyName(val) {
  468. this.ruleForm.storeToCompany = val[1];
  469. console.log(this.ruleForm.storeToCompany);
  470. },
  471. // 联系人电话
  472. linkerMobile(val) {
  473. this.parmValue.wsm_mobile = val;
  474. },
  475. // 联系人
  476. linker(val) {
  477. this.parmValue.wsm_name = val;
  478. },
  479. // 仓库详细地址
  480. stockDetail(val) {
  481. console.log(val);
  482. this.parmValue.addr = val;
  483. },
  484. //仓库地址选择
  485. areaSelect(val) {
  486. console.log(val);
  487. this.ruleForm.stockToArea = val;
  488. this.parmValue.addr = val;
  489. },
  490. // 收发货地址选择
  491. selectArea(val) {
  492. this.parmValue.addr_code.provice_code = val[0];
  493. this.parmValue.addr_code.city_code = val[1];
  494. this.parmValue.addr_code.area_code = val[2];
  495. this.ruleForm.linker_addr = val;
  496. },
  497. // 收发货详细地址
  498. linkerDetail(val) {
  499. this.parmValue.wsm_addr = val;
  500. },
  501. // 仓库所在公司
  502. getValue(val) {
  503. this.parmValue.supplierNo = val;
  504. },
  505. // 仓库名
  506. getValue1(val) {
  507. this.parmValue.name = val;
  508. },
  509. // 负责人
  510. getValue2(val) {
  511. console.log(val);
  512. this.stockDutyer = val;
  513. },
  514. closeModel() {
  515. console.log("closeModel!!");
  516. },
  517. async initForm() {
  518. this.loading = true;
  519. // await this.getClist();
  520. // await this.getRole();
  521. this.ruleForm = {
  522. stockName: "my-Stock", //仓库名称
  523. stockDutyer: "", //仓库负责人
  524. linker: "", //收发货联系人
  525. linker_mobile: "", //收发货人联系电话
  526. linker_addr: "", //收发货地址
  527. selectStock_go_options: [],
  528. stockDutyer_options: [],
  529. };
  530. console.log(this.addId);
  531. if (this.addId === "add") {
  532. console.log("新建仓库节点");
  533. console.log(this.ruleForm);
  534. this.rulesThis = this.rules;
  535. await this.resetForm();
  536. } else if (this.addId === "detail") {
  537. console.log("detail");
  538. this.rulesThis = {};
  539. await this.resetForm(this.sitem);
  540. // await this.initData()
  541. } else {
  542. console.log("当前是编辑按钮");
  543. this.rulesThis = this.rules;
  544. }
  545. this.loading = false;
  546. },
  547. async getClist() {
  548. this.organizeList = [];
  549. const res = await asyncRequest.getClist({});
  550. if (res && res.code === 0 && res.data) {
  551. this.organizeList = res.data;
  552. this.recursion(this.organizeList);
  553. }
  554. },
  555. recursion(list) {
  556. list.map((v) => {
  557. if (v && Array.isArray(v.child)) {
  558. v.value = v.id + "";
  559. v.label = v.name;
  560. if (v.child.length === 0) {
  561. delete v["child"];
  562. } else {
  563. this.recursion(v.child);
  564. }
  565. }
  566. return v;
  567. });
  568. },
  569. async getRole() {
  570. const model = {
  571. status: "", // 状态
  572. level: "", // 姓名
  573. role_name: "",
  574. };
  575. const res = await asyncRequest.getRole(model);
  576. if (res && res.code === 0 && res.data) {
  577. this.roleList = res.data;
  578. this.roleList.map((v1) => {
  579. v1.id += "";
  580. v1.status += "";
  581. return v1;
  582. });
  583. }
  584. },
  585. async resetForm(sitem) {
  586. // 重置
  587. await this.$nextTick(() => {
  588. if (this.$refs.ruleForm) {
  589. this.$refs.ruleForm.resetFields();
  590. this.$refs.ruleForm.clearValidate();
  591. this.ruleForm = {
  592. dutyer_mobile: "18818818818",
  593. stockDetail: "顺义区宏远888",
  594. selectStock_go: "", //出库仓库
  595. selectStock_go_options: [], //出库仓库列表
  596. stockName: "my-STock", //仓库名称
  597. linker: "张三",
  598. linker_mobile: "13223289230",
  599. linker_detail: "朝阳区太阳城666",
  600. stockDutyer: "", //仓库负责人
  601. stockDutyer_options: [], //仓库负责人列表
  602. };
  603. if (this.id === "add" || this.isDetail) {
  604. this.rules.username[0].required = false;
  605. }
  606. }
  607. });
  608. },
  609. async submitForm(formName) {
  610. let paraValue = {
  611. name: this.ruleForm.stockName,
  612. supplierNo: this.ruleForm.storeToCompany,
  613. wsmtype: "1", //仓库类型
  614. addr: this.ruleForm.stockDetail, //仓库地址
  615. contactor: this.stockDutyer, //仓库联系人职位
  616. mobile: this.ruleForm.dutyer_mobile, //仓库联系人
  617. position: "采购",
  618. // wsm_type:"",后台暂时不用
  619. wsm_name: this.ruleForm.linker,
  620. wsm_mobile: this.ruleForm.linker_mobile,
  621. addr_code: {
  622. // provice_code: this.ruleForm.linker_addr[0],
  623. // city_code: this.ruleForm.linker_addr[1],
  624. // area_code: this.ruleForm.linker_addr[2],
  625. },
  626. wsm_addr: this.ruleForm.linker_detail,
  627. addrs_code: {
  628. // provice_code: this.ruleForm.stockToArea[0],
  629. // city_code: this.ruleForm.stockToArea[1],
  630. // area_code: this.ruleForm.stockToArea[2],
  631. },
  632. };
  633. console.log(paraValue);
  634. console.log(this.ruleForm);
  635. this.$refs[formName].validate((valid) => {
  636. console.log(valid);
  637. if (valid) {
  638. console.log("submit!");
  639. this.getList(paraValue);
  640. } else {
  641. console.log("error submit!!");
  642. return false;
  643. }
  644. });
  645. },
  646. // 表单提交
  647. async getList(paraValue) {
  648. const res = await asyncRequest.add(paraValue);
  649. if (res && res.code === 0 && res.data) {
  650. console.log(res.data);
  651. } else if (res && res.code >= 100 && res.code <= 104) {
  652. await this.logout();
  653. } else {
  654. }
  655. this.loading = false;
  656. },
  657. async getDutyer() {
  658. this.loading = true;
  659. const obj = {
  660. name: "",
  661. page: 1,
  662. size: 15,
  663. status: "",
  664. username: "",
  665. };
  666. const res = await asyncRequest.getlist(obj);
  667. if (res && res.code === 0 && res.data) {
  668. const { list } = res.data;
  669. this.ruleForm.stockDutyer_options = list;
  670. console.log(this.ruleForm.stockDutyer_options);
  671. // console.log(res.data.list);
  672. // res.data.list.forEach((element) => {
  673. // // let dutyer = {
  674. // // label: element.nickname,
  675. // // value: element.depart[0] ? element.depart[0].name : "",
  676. // // };
  677. // // console.log(this.ruleForm.stockDutyer_options);
  678. // this.ruleForm.stockDutyer_options.push(element);
  679. // });
  680. } else if (res && res.code >= 100 && res.code <= 104) {
  681. await this.logout();
  682. } else {
  683. this.tableData = [];
  684. this.pageInfo.total = 0;
  685. }
  686. this.loading = false;
  687. },
  688. async getCompany() {
  689. this.loading = true;
  690. const obj = {
  691. page: 1,
  692. size: 15,
  693. };
  694. const res = await asyncRequest.getCompany(obj);
  695. if (res && res.code === 0 && res.data) {
  696. console.log(res.data.list);
  697. res.data.list.forEach((element) => {
  698. let company = {
  699. label: element.name,
  700. value: element.code,
  701. };
  702. // console.log(this.ruleForm.selectStock_go_options);
  703. this.ruleForm.selectStock_go_options.push(company);
  704. // this.ruleForm.stockDutyer_options.push(dutyer);
  705. });
  706. // console.log(this.ruleForm.selectStock_go_options);
  707. // this.tableData = res.data.list;
  708. // this.pageInfo.total = Number(res.data.count);
  709. } else if (res && res.code >= 100 && res.code <= 104) {
  710. await this.logout();
  711. } else {
  712. this.tableData = [];
  713. this.pageInfo.total = 0;
  714. }
  715. this.getDutyer();
  716. this.loading = false;
  717. },
  718. // 新建仓库
  719. async addStock() {
  720. this.loading = true;
  721. console.log(this.parmValue);
  722. const res = await asyncRequest.addStock(this.parmValue);
  723. if (res && res.code === 0 && res.data) {
  724. console.log(res.data.list);
  725. res.data.list.forEach((element) => {
  726. // console.log(element.nickname);
  727. let company = {
  728. label: element.name,
  729. value: element.code,
  730. };
  731. this.ruleForm.selectStock_go_options.push(company);
  732. // this.ruleForm.stockDutyer_options.push(dutyer);
  733. });
  734. console.log(this.ruleForm.selectStock_go_options);
  735. // this.tableData = res.data.list;
  736. // this.pageInfo.total = Number(res.data.count);
  737. } else if (res && res.code >= 100 && res.code <= 104) {
  738. await this.logout();
  739. } else {
  740. // this.tableData = [];
  741. // this.pageInfo.total = 0;
  742. }
  743. this.loading = false;
  744. },
  745. // 获取仓库详情
  746. async getStocDetail() {
  747. this.loading = true;
  748. // console.log(this.parmValue);
  749. const res = await asyncRequest.detail(5);
  750. if (res && res.code === 0 && res.data) {
  751. console.log(res.data.list);
  752. res.data.list.forEach((element) => {
  753. // console.log(element.nickname);
  754. let company = {
  755. label: element.name,
  756. value: element.code,
  757. };
  758. this.ruleForm.selectStock_go_options.push(company);
  759. // this.ruleForm.stockDutyer_options.push(dutyer);
  760. });
  761. console.log(this.ruleForm.selectStock_go_options);
  762. // this.tableData = res.data.list;
  763. // this.pageInfo.total = Number(res.data.count);
  764. } else if (res && res.code >= 100 && res.code <= 104) {
  765. await this.logout();
  766. } else {
  767. // this.tableData = [];
  768. // this.pageInfo.total = 0;
  769. }
  770. this.loading = false;
  771. },
  772. },
  773. };
  774. </script>
  775. <style lang="scss" scoped>
  776. </style>