index.vue 16 KB

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