index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <template>
  2. <div class="storeSet pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <ex-table
  7. v-loading="false"
  8. :table="table"
  9. :data="tableData"
  10. :columns="columns"
  11. :page="pageInfo"
  12. :size="size"
  13. @page-curr-change="handlePageChange"
  14. @page-size-change="handleSizeChange"
  15. @screen-reset="
  16. pageInfo.curr = 1;
  17. parmValue.page = 1;
  18. searchList();
  19. "
  20. @screen-submit="
  21. pageInfo.curr = 1;
  22. parmValue.page = 1;
  23. searchList();
  24. "
  25. >
  26. <template #table-header="{}">
  27. <div style="width: 100%">
  28. <el-row style="padding: 0 0 10px 80px">
  29. <!-- 创建时间 -->
  30. <el-col :span="18" style="width: 303px; padding: 0">
  31. <period-date-picker
  32. :start="parmValue.start"
  33. :end="parmValue.end"
  34. :type="1"
  35. :width="'135px'"
  36. :title="'创建'"
  37. :size="searchSize"
  38. @numReturned="numReturned($event, 0)"
  39. />
  40. </el-col>
  41. <el-col :span="18" style="width: 340px; padding: 0">
  42. <!-- <search-customer
  43. :value="supplierNo"
  44. :size="searchSize"
  45. :code="parmValue.supplierNo"
  46. :companyNo="parmValue.supplierNo"
  47. :placeholder="'供应商公司名称'"
  48. :is-detail="true"
  49. :disabled="false"
  50. :names="''"
  51. @searchChange="supplierChange"
  52. /> -->
  53. <search-supplier
  54. :value="supplierNo"
  55. :size="searchSize"
  56. :code="parmValue.supplierNo"
  57. :placeholder="'供应商公司名称'"
  58. :is-detail="false"
  59. :disabled="false"
  60. :names="''"
  61. @searchChange="supplierChange"
  62. />
  63. <!-- <search-customer
  64. :value="supplierNo"
  65. :size="searchSize"
  66. :placeholder="'供应商公司名称'"
  67. :disabled="false"
  68. @searchChange="supplierChange"
  69. /> -->
  70. </el-col>
  71. <el-col
  72. :span="3"
  73. style="width: 56px; margin-left: 10px"
  74. class="fr"
  75. >
  76. <el-button
  77. :size="searchSize"
  78. type="primary"
  79. @click="searchList"
  80. >
  81. 刷新
  82. </el-button>
  83. </el-col>
  84. </el-row>
  85. <el-row style="padding: 0">
  86. <el-col :span="4" style="width: 120px; padding: 0">
  87. <el-select
  88. v-model="parmValue.wsm_type"
  89. style="width: 100%"
  90. clearable
  91. :size="searchSize"
  92. @change="
  93. pageInfo.curr = 1;
  94. parmValue.page = 1;
  95. searchList();
  96. "
  97. placeholder="仓库类型"
  98. >
  99. <el-option
  100. v-for="item in options"
  101. :key="item.value"
  102. :label="item.label"
  103. :value="item.value"
  104. >
  105. </el-option>
  106. </el-select>
  107. </el-col>
  108. <el-col :span="18" style="width: 420px; padding: 0 0 0 10px">
  109. <el-input
  110. placeholder="关键字"
  111. v-model="input"
  112. maxlength="40"
  113. :size="searchSize"
  114. class="input-with-select"
  115. >
  116. <el-select
  117. v-model="select"
  118. slot="prepend"
  119. style="width: 125px"
  120. placeholder="关键字类型"
  121. >
  122. <el-option label="仓库编码" value="1"></el-option>
  123. <el-option label="负责人姓名" value="2"></el-option>
  124. <el-option label="负责人手机号" value="3"></el-option>
  125. </el-select>
  126. <el-button
  127. slot="append"
  128. icon="el-icon-search"
  129. @click="searchList"
  130. ></el-button>
  131. </el-input>
  132. </el-col>
  133. <el-col
  134. :span="4"
  135. style="width: 66px; padding-left: 10px"
  136. class="fr"
  137. >
  138. <el-button
  139. type="warning"
  140. class="fl"
  141. :size="searchSize"
  142. @click="restSearch"
  143. >
  144. 重置
  145. </el-button>
  146. </el-col>
  147. <el-col
  148. :span="3"
  149. style="width: 56px"
  150. class="mr10 fr"
  151. v-if="powers.some((item) => item == '003')"
  152. >
  153. <el-button
  154. class="fl"
  155. :size="searchSize"
  156. type="success"
  157. @click="openModal('add', false)"
  158. >
  159. 新建
  160. </el-button>
  161. </el-col>
  162. </el-row>
  163. </div>
  164. </template>
  165. <template #status="{ scope }">
  166. <el-tag
  167. :size="tablebtnSize"
  168. :type="scope.row.status == '0' ? 'warning' : ''"
  169. v-text="
  170. (statusOptions.find((item) => item.id == scope.row.status) || {})
  171. .label || '--'
  172. "
  173. ></el-tag>
  174. </template>
  175. <template #operation="{ scope }">
  176. <el-tooltip
  177. v-if="powers.some((item) => item == '007')"
  178. effect="dark"
  179. content="详情"
  180. placement="top"
  181. >
  182. <i
  183. class="el-icon-view tb-icon"
  184. @click="openModal(scope.row.id, true)"
  185. ></i>
  186. </el-tooltip>
  187. <el-tooltip
  188. v-if="powers.some((item) => item == '005')"
  189. effect="dark"
  190. content="修改"
  191. placement="top"
  192. >
  193. <i
  194. class="el-icon-edit tb-icon"
  195. @click="openModal(scope.row.id, false)"
  196. ></i>
  197. </el-tooltip>
  198. <el-tooltip
  199. v-if="
  200. powers.some((item) => item == '004') && scope.row.status === '1'
  201. "
  202. effect="dark"
  203. content="禁用"
  204. placement="top"
  205. >
  206. <i
  207. class="el-icon-video-pause tb-icon"
  208. @click="statusConfirm(scope.row.id, scope.row.status)"
  209. ></i>
  210. </el-tooltip>
  211. <el-tooltip
  212. v-if="
  213. powers.some((item) => item == '004') && scope.row.status === '0'
  214. "
  215. effect="dark"
  216. content="启用"
  217. placement="top"
  218. >
  219. <i
  220. class="el-icon-video-play tb-icon"
  221. @click="statusConfirm(scope.row.id, scope.row.status)"
  222. ></i>
  223. </el-tooltip>
  224. <el-tooltip
  225. v-if="powers.some((item) => item == '006')"
  226. effect="dark"
  227. content="删除"
  228. placement="top"
  229. >
  230. <i
  231. class="el-icon-delete tb-icon"
  232. @click="deleteById(scope.row.id, scope.row.status)"
  233. ></i>
  234. </el-tooltip>
  235. </template>
  236. </ex-table>
  237. <add-edit
  238. :id="modelId"
  239. :show-model="showModel"
  240. :is-detail="isDetail"
  241. @refresh="searchList"
  242. @cancel="showModel = false"
  243. />
  244. </div>
  245. <div v-else>
  246. <no-auth></no-auth>
  247. </div>
  248. </div>
  249. </template>
  250. <script>
  251. import mixinPage from "@/mixins/elPaginationHandle";
  252. import resToken from "@/mixins/resToken";
  253. import asyncRequest from "@/apis/service/serviceParam/storeSet";
  254. import addEdit from "./addEdit";
  255. import { mapGetters } from "vuex";
  256. export default {
  257. name: "storeSet",
  258. mixins: [mixinPage, resToken],
  259. components: {
  260. addEdit,
  261. },
  262. computed: {
  263. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  264. powers() {
  265. let tran =
  266. this.$store.getters.btnList.find(
  267. (item) => item.menu_route == "storeSet"
  268. ) || {};
  269. if (tran && tran.action && tran.action.length > 0) {
  270. return tran.action;
  271. } else {
  272. return [];
  273. }
  274. },
  275. },
  276. data() {
  277. return {
  278. options: [
  279. // {
  280. // value: "1",
  281. // label: "系统仓",
  282. // },
  283. // {
  284. // value: "2",
  285. // label: "虚拟仓",
  286. // },
  287. // {
  288. // value: "3",
  289. // label: "自建仓",
  290. // },
  291. {
  292. value: "5",
  293. label: "销售仓",
  294. },
  295. {
  296. value: "4",
  297. label: "次品仓",
  298. },
  299. ],
  300. select: "1", //选择
  301. input: "",
  302. supplierNo: [], //供应商
  303. stock_sn: "", //企业/仓库编码
  304. stock_name: "", //企业/仓库名称
  305. link: "", //联系电话/联系人
  306. loading: true,
  307. showModel: false,
  308. isDetail: false,
  309. modelId: 0,
  310. parmValue: {
  311. supplierNo: "", //供应商编码
  312. wsm_code: "", //仓库编码
  313. wsm_type: "",
  314. start: "", //新建起始时间
  315. end: "", //新建结束时间
  316. mobile: "", //手机号
  317. contactor_name: "", //联系人
  318. },
  319. tableData: [],
  320. passwordModel: false,
  321. passwordModelId: 0,
  322. isPasswordDetail: false,
  323. // 表格 - 数据
  324. tableData: [],
  325. // 表格 - 参数
  326. table: {
  327. stripe: true,
  328. border: true,
  329. _defaultHeader_: ["setcol"],
  330. },
  331. // 表格 - 分页
  332. pageInfo: {
  333. size: 15,
  334. curr: 1,
  335. total: 0,
  336. },
  337. // 表格 - 列参数
  338. columns: [
  339. {
  340. prop: "wsm_code",
  341. label: "编号",
  342. width: "170px",
  343. },
  344. {
  345. prop: "name",
  346. label: "仓库名称",
  347. },
  348. {
  349. prop: "type_name",
  350. label: "仓库类型",
  351. width: "80px",
  352. },
  353. {
  354. prop: "supplierNo",
  355. label: "供应商编号",
  356. width: "140px",
  357. },
  358. {
  359. prop: "supplier_name",
  360. label: "供应商公司",
  361. "min-width": "140px",
  362. },
  363. {
  364. prop: "status",
  365. label: "状态",
  366. width: "60px",
  367. // sortable: true,
  368. _slot_: "status",
  369. },
  370. {
  371. prop: "contactor_name",
  372. label: "负责人",
  373. width: "70px",
  374. },
  375. {
  376. prop: "mobile",
  377. label: "负责人电话",
  378. width: "100px",
  379. },
  380. {
  381. prop: "addtime",
  382. label: "创建时间",
  383. width: "140px",
  384. },
  385. {
  386. prop: "",
  387. label: "操作",
  388. width: "140px",
  389. fixed: "right",
  390. _noset_: true,
  391. _slot_: "operation",
  392. },
  393. ],
  394. // 状态
  395. statusOptions: [
  396. { id: "0", label: "禁用" },
  397. { id: "1", label: "启用" },
  398. ],
  399. };
  400. },
  401. mounted() {
  402. this.searchList();
  403. },
  404. methods: {
  405. supplierChange(e) {
  406. if (e && e.id) {
  407. this.supplierNo = [e.code];
  408. this.parmValue.supplierNo = e.code; //供应商编码
  409. } else {
  410. this.parmValue.supplierNo = "";
  411. this.supplierNo = [];
  412. }
  413. this.parmValue.page = 1;
  414. this.searchList();
  415. },
  416. stockChange(e) {
  417. if (e && e.id) {
  418. this.parmValue.wsm_code = e.code; //供应商编码
  419. } else {
  420. this.parmValue.wsm_code = "";
  421. }
  422. this.parmValue.page = 1;
  423. this.searchList();
  424. },
  425. addList(id) {
  426. window.vm.$router.push({
  427. path: "addStore",
  428. query: {
  429. id: id,
  430. },
  431. });
  432. },
  433. restSearch() {
  434. // 表格 - 分页
  435. this.pageInfo = {
  436. size: 15,
  437. curr: 1,
  438. total: 0,
  439. };
  440. this.supplierNo = [];
  441. this.input = "";
  442. this.select = "1";
  443. this.parmValue = {
  444. supplierNo: "", //供应商编码
  445. wsm_code: "", //仓库编码
  446. wsm_type:"",
  447. start: "", //新建起始时间
  448. end: "", //新建结束时间
  449. mobile: "", //手机号
  450. contactor_name: "", //联系人
  451. page: 1, // 页码
  452. size: 15, // 每页显示条数
  453. };
  454. this.searchList();
  455. },
  456. openModal(id, isDetail) {
  457. this.showModel = true;
  458. this.modelId = id;
  459. this.isDetail = isDetail;
  460. },
  461. async searchList() {
  462. if (
  463. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  464. (this.parmValue.start == "" && this.parmValue.end != "")
  465. ) {
  466. this.$message.warning("开始时间和结束时间不能为空");
  467. return;
  468. }
  469. this.loading = true;
  470. this.parmValue.wsm_code = this.select === "1" ? this.input : "";
  471. this.parmValue.contactor_name = this.select === "2" ? this.input : "";
  472. this.parmValue.mobile = this.select === "3" ? this.input : "";
  473. const res = await asyncRequest.list(this.parmValue);
  474. if (res && res.code === 0 && res.data) {
  475. console.log("aaaaaaaaaaaaaaaa", res);
  476. this.tableData = res.data.list;
  477. this.pageInfo.total = Number(res.data.count);
  478. } else if (res && res.code >= 100 && res.code <= 104) {
  479. await this.logout();
  480. } else {
  481. this.tableData = [];
  482. this.pageInfo.total = 0;
  483. }
  484. this.loading = false;
  485. },
  486. async statusConfirm(id, status) {
  487. let str = status === "1" ? "禁用" : "启用";
  488. await this.$confirm("确定要改为" + str + "?", {
  489. confirmButtonText: "确定",
  490. cancelButtonText: "取消",
  491. type: "warning",
  492. })
  493. .then(async () => {
  494. this.loading = true;
  495. const model = {
  496. id: id,
  497. status: status === "1" ? "0" : "1",
  498. };
  499. const res = await asyncRequest.status(model);
  500. if (res && res.code === 0) {
  501. this.loading = false;
  502. this.$notify.success({
  503. title: "状态修改成功!",
  504. message: "",
  505. });
  506. await this.searchList();
  507. } else if (res && res.code >= 100 && res.code <= 104) {
  508. await this.logout();
  509. } else {
  510. this.$message.warning(res.message);
  511. }
  512. })
  513. .catch(() => {
  514. console.log("取消");
  515. });
  516. },
  517. async deleteById(id, status) {
  518. if (status === "1") {
  519. this.$message.warning("正在启用的仓库不能删除!");
  520. return;
  521. }
  522. await this.$confirm("确定要删除?", {
  523. confirmButtonText: "确定",
  524. cancelButtonText: "取消",
  525. type: "warning",
  526. })
  527. .then(async () => {
  528. const model = {
  529. id: id,
  530. // status: status === "1" ? "0" : "1",
  531. };
  532. const res = await asyncRequest.delete(model);
  533. if (res && res.code === 0) {
  534. this.$notify.success({
  535. title: "删除成功",
  536. message: "",
  537. });
  538. this.searchList();
  539. } else if (res && res.code >= 100 && res.code <= 104) {
  540. await this.logout();
  541. } else {
  542. this.$message.warning(res.message);
  543. }
  544. })
  545. .catch(() => {
  546. console.log("取消");
  547. });
  548. },
  549. },
  550. };
  551. </script>
  552. <style lang="scss" scoped>
  553. </style>