index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <div class="pageIndexClass">
  3. <div class="content">
  4. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :selectConfig="selectConfig" :config="config" :loading="loading"
  5. highlight-current-row :action-list="[
  6. ]" @get-list="getList">
  7. <template #code="{item}">
  8. <div style="width:100%">
  9. <span class="el-click" @click="getDtl(item)">{{item.code}}</span>
  10. </div>
  11. </template>
  12. <template #time="{item}">
  13. <div style="width:100%">
  14. <el-date-picker v-model="item.settleStartDate" type="date" style="width:150px" placeholder="开始日期" value-format="YYYY-MM-DD"
  15. :clearable="false" @change="()=>changeDate(item.settleStartDate,item.settleEndDate,item.id)" />
  16. <el-date-picker v-model="item.settleEndDate" type="date" style="width:150px" placeholder="结束日期" value-format="YYYY-MM-DD"
  17. :clearable="false" @change="()=>changeDate(item.settleStartDate,item.settleEndDate,item.id)" />
  18. </div>
  19. </template>
  20. </byTable>
  21. </div>
  22. <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="60%">
  23. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
  24. </byForm>
  25. <template #footer>
  26. <el-button @click="dialogVisible = false" size="default">取 消</el-button>
  27. <el-button type="primary" @click="submitForm()" size="default">确 定</el-button>
  28. </template>
  29. </el-dialog>
  30. </div>
  31. </template>
  32. <script setup>
  33. import { computed, ref } from "vue";
  34. import byTable from "@/components/byTable/index";
  35. import byForm from "@/components/byForm/index";
  36. const { proxy } = getCurrentInstance();
  37. const sealType = computed(() => proxy.useUserStore().allDict["seal_type"]);
  38. const userList = ref([]);
  39. const deptData = ref([]);
  40. const typeData = ref([
  41. {
  42. label: "收入",
  43. value: "10",
  44. },
  45. {
  46. label: "支出",
  47. value: "20",
  48. },
  49. ]);
  50. const sourceList = ref({
  51. data: [],
  52. pagination: {
  53. total: 0,
  54. pageNum: 1,
  55. pageSize: 10,
  56. keyword: "",
  57. },
  58. });
  59. const loading = ref(false);
  60. const statusData = ref([
  61. {
  62. label: "草稿",
  63. value: 0,
  64. },
  65. {
  66. label: "审批中",
  67. value: 10,
  68. },
  69. {
  70. label: "审批驳回",
  71. value: 20,
  72. },
  73. {
  74. label: "审批通过",
  75. value: 30,
  76. },
  77. {
  78. label: "作废",
  79. value: 88,
  80. },
  81. ]);
  82. const belongTypeData = ref([
  83. {
  84. dictKey: "1",
  85. dictValue: "归属工厂",
  86. },
  87. {
  88. dictKey: "2",
  89. dictValue: "归属业务",
  90. },
  91. ]);
  92. const contractType = ref([
  93. {
  94. dictKey: "3",
  95. dictValue: "打样订单",
  96. },
  97. {
  98. dictKey: "2",
  99. dictValue: "内销订单",
  100. },
  101. {
  102. dictKey: "1",
  103. dictValue: "外贸订单(退税)",
  104. },
  105. {
  106. dictKey: "4",
  107. dictValue: "外贸订单(不退税)",
  108. },
  109. ]);
  110. const selectConfig = computed(() => {
  111. return [];
  112. });
  113. const config = computed(() => {
  114. return [
  115. {
  116. attrs: {
  117. label: "订单编号",
  118. prop: "contractCode",
  119. fixed: "left",
  120. width: 150,
  121. },
  122. },
  123. {
  124. attrs: {
  125. label: "业务员",
  126. prop: "salesmanName",
  127. width: 100,
  128. },
  129. },
  130. {
  131. attrs: {
  132. label: "跟单员",
  133. prop: "merchUserName",
  134. width: 100,
  135. },
  136. },
  137. {
  138. attrs: {
  139. label: "订单类型",
  140. prop: "contractType",
  141. width: 130,
  142. },
  143. render(val) {
  144. return proxy.dictKeyValue(val, contractType.value);
  145. },
  146. },
  147. {
  148. attrs: {
  149. label: "订单归属",
  150. prop: "belongType",
  151. width: 110,
  152. },
  153. render(val) {
  154. return proxy.dictKeyValue(val, belongTypeData.value);
  155. },
  156. },
  157. {
  158. attrs: {
  159. label: "销售金额",
  160. prop: "amount",
  161. width: 100,
  162. },
  163. render(val) {
  164. return proxy.moneyFormat(val, 2);
  165. },
  166. },
  167. {
  168. attrs: {
  169. label: "订单出货金额",
  170. prop: "factoryAmount",
  171. width: 120,
  172. },
  173. render(val) {
  174. return proxy.moneyFormat(val, 2);
  175. },
  176. },
  177. {
  178. attrs: {
  179. label: "出货申请出货金额",
  180. prop: "sumOutFactoryMoney",
  181. width: 160,
  182. },
  183. render(val) {
  184. return proxy.moneyFormat(val, 2);
  185. },
  186. },
  187. {
  188. attrs: {
  189. label: "已收定金",
  190. prop: "deposit",
  191. width: 90,
  192. },
  193. render(val) {
  194. return proxy.moneyFormat(val, 2);
  195. },
  196. },
  197. {
  198. attrs: {
  199. label: "是否可结算",
  200. prop: "isSettlement",
  201. width: 100,
  202. },
  203. render(val) {
  204. return val == 1 ? "是" : "否";
  205. },
  206. },
  207. {
  208. attrs: {
  209. label: "是否已结算",
  210. slot: "time",
  211. width: 180,
  212. },
  213. },
  214. {
  215. attrs: {
  216. label: "客户名称",
  217. prop: "customerName",
  218. "min-width": 150,
  219. },
  220. },
  221. {
  222. attrs: {
  223. label: "客户简称",
  224. prop: "customerShortName",
  225. width: 110,
  226. },
  227. },
  228. {
  229. attrs: {
  230. label: "应收金额",
  231. prop: "receivableAmount",
  232. width: 90,
  233. },
  234. render(val) {
  235. return proxy.moneyFormat(val, 2);
  236. },
  237. },
  238. {
  239. attrs: {
  240. label: "收款金额",
  241. prop: "sumClaimMoney",
  242. width: 90,
  243. },
  244. render(val) {
  245. return proxy.moneyFormat(val, 2);
  246. },
  247. },
  248. {
  249. attrs: {
  250. label: "未收金额",
  251. prop: "outstandingAmount",
  252. width: 90,
  253. },
  254. render(val) {
  255. return proxy.moneyFormat(val, 2);
  256. },
  257. },
  258. {
  259. attrs: {
  260. label: "出货日期",
  261. prop: "firstTruckDate",
  262. width: 110,
  263. },
  264. },
  265. {
  266. attrs: {
  267. label: "账龄级别",
  268. prop: "accountAge",
  269. width: 120,
  270. },
  271. },
  272. // {
  273. // attrs: {
  274. // label: "审批状态",
  275. // prop: "status",
  276. // width: 100,
  277. // },
  278. // render(type) {
  279. // return proxy.dictValueLabel(type, statusData.value);
  280. // },
  281. // },
  282. // {
  283. // attrs: {
  284. // label: "操作",
  285. // width: "120",
  286. // align: "center",
  287. // },
  288. // renderHTML(row) {
  289. // return row.createUser == proxy.useUserStore().user.userId
  290. // ? [
  291. // row.status == 0
  292. // ? {
  293. // attrs: {
  294. // label: "修改",
  295. // type: "primary",
  296. // text: true,
  297. // },
  298. // el: "button",
  299. // click() {
  300. // clickUpdate(row);
  301. // },
  302. // }
  303. // : {},
  304. // row.status == 0
  305. // ? {
  306. // attrs: {
  307. // label: "删除",
  308. // type: "danger",
  309. // text: true,
  310. // },
  311. // el: "button",
  312. // click() {
  313. // proxy
  314. // .msgConfirm()
  315. // .then((res) => {
  316. // proxy
  317. // .post("/educationSubsidy/delete", {
  318. // id: row.id,
  319. // })
  320. // .then((res) => {
  321. // proxy.msgTip("操作成功", 1);
  322. // getList();
  323. // });
  324. // })
  325. // .catch((err) => {});
  326. // },
  327. // }
  328. // : {},
  329. // row.status == 10 || row.status == 30
  330. // ? {
  331. // attrs: {
  332. // label: "作废",
  333. // type: "danger",
  334. // text: true,
  335. // },
  336. // el: "button",
  337. // click() {
  338. // proxy
  339. // .msgConfirm()
  340. // .then((res) => {
  341. // proxy
  342. // .post("/educationSubsidy/cancellation", {
  343. // id: row.id,
  344. // })
  345. // .then((res) => {
  346. // proxy.msgTip("操作成功", 1);
  347. // getList();
  348. // });
  349. // })
  350. // .catch((err) => {});
  351. // },
  352. // }
  353. // : {},
  354. // ]
  355. // : [];
  356. // },
  357. // },
  358. ];
  359. });
  360. const corporationList = ref([]);
  361. const getList = async (req) => {
  362. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  363. loading.value = true;
  364. proxy
  365. .post("/report/orderSummary", sourceList.value.pagination)
  366. .then((res) => {
  367. sourceList.value.data = res.rows;
  368. sourceList.value.pagination.total = res.total;
  369. setTimeout(() => {
  370. loading.value = false;
  371. }, 200);
  372. });
  373. };
  374. getList();
  375. const getDeptData = (val) => {
  376. proxy
  377. .get("/tenantUser/list", {
  378. pageNum: 1,
  379. pageSize: 10000,
  380. tenantId: proxy.useUserStore().user.tenantId,
  381. companyId: proxy.useUserStore().user.companyId,
  382. })
  383. .then((res) => {
  384. userList.value = res.rows.map((item) => {
  385. return {
  386. ...item,
  387. label: item.nickName,
  388. value: item.userId,
  389. };
  390. });
  391. });
  392. proxy
  393. .get("/tenantDept/list", {
  394. pageNum: 1,
  395. pageSize: 9999,
  396. keyword: "",
  397. ancestors: proxy.useUserStore().user.companyId,
  398. tenantId: proxy.useUserStore().user.tenantId,
  399. // type: 2,
  400. })
  401. .then((res) => {
  402. deptData.value = proxy.handleTree(res.data, "deptId");
  403. });
  404. };
  405. getDeptData();
  406. const modalType = ref("add");
  407. const dialogVisible = ref(false);
  408. const loadingDialog = ref(false);
  409. const submit = ref(null);
  410. const formOption = reactive({
  411. inline: true,
  412. labelWidth: 100,
  413. itemWidth: 100,
  414. rules: [],
  415. });
  416. const formConfig = computed(() => {
  417. return [
  418. {
  419. type: "title1",
  420. title: "基本信息",
  421. },
  422. {
  423. type: "input",
  424. prop: "name",
  425. label: "印章名称",
  426. required: true,
  427. itemWidth: 50,
  428. itemType: "text",
  429. },
  430. {
  431. type: "select",
  432. prop: "sealType",
  433. label: "印章类型",
  434. data: sealType.value,
  435. itemWidth: 50,
  436. },
  437. {
  438. type: "select",
  439. prop: "applyUserId",
  440. label: "存管人员",
  441. required: true,
  442. filterable: true,
  443. data: userList.value,
  444. itemWidth: 50,
  445. fn: (val) => {
  446. let current = userList.value.find((x) => x.value == val);
  447. console.log(current, "ada");
  448. if (current) {
  449. formData.data.deptId = current.deptId;
  450. }
  451. },
  452. },
  453. {
  454. type: "treeSelect",
  455. prop: "deptId",
  456. label: "存管部门",
  457. data: deptData.value,
  458. propsTreeLabel: "deptName",
  459. propsTreeValue: "deptId",
  460. itemWidth: 50,
  461. disabled: 50,
  462. },
  463. {
  464. type: "input",
  465. prop: "accountNumber",
  466. label: "印章用途",
  467. itemWidth: 100,
  468. itemType: "textarea",
  469. },
  470. ];
  471. });
  472. const rules = ref({
  473. name: [{ required: true, message: "请输入承包商", trigger: "blur" }],
  474. taxPoints: [{ required: true, message: "请输入税点", trigger: "blur" }],
  475. accountBank: [{ required: true, message: "请输入开户行", trigger: "blur" }],
  476. accountName: [{ required: true, message: "请输入开户名", trigger: "blur" }],
  477. accountNumber: [{ required: true, message: "请输入账号", trigger: "blur" }],
  478. });
  479. const formData = reactive({
  480. data: {
  481. accountRemainderList: [{ currency: "", remainder: undefined }],
  482. },
  483. });
  484. const openModal = (val) => {
  485. // modalType.value = val;
  486. // formData.data = {
  487. // accountRemainderList: [{ currency: "", remainder: undefined }],
  488. // };
  489. // loadingDialog.value = false;
  490. // dialogVisible.value = true;
  491. proxy.$router.replace({
  492. path: "/platform_manage/process/processApproval",
  493. query: {
  494. flowKey: "education_subsidy_flow",
  495. flowName: "学历补贴发起流程",
  496. random: proxy.random(),
  497. },
  498. });
  499. };
  500. const clickBalance = () => {
  501. if (
  502. formData.data.accountRemainderList &&
  503. formData.data.accountRemainderList.length > 0
  504. ) {
  505. formData.data.accountRemainderList.push({
  506. currency: "",
  507. remainder: undefined,
  508. });
  509. } else {
  510. formData.data.accountRemainderList = [
  511. { currency: "", remainder: undefined },
  512. ];
  513. }
  514. };
  515. const handleRemove = (index) => {
  516. formData.data.accountRemainderList.splice(index, 1);
  517. };
  518. const isRepeat = (arr) => {
  519. var hash = {};
  520. for (var i in arr) {
  521. if (hash[arr[i].currency]) return true;
  522. hash[arr[i].currency] = true;
  523. }
  524. return false;
  525. };
  526. const submitForm = () => {
  527. submit.value.handleSubmit(() => {
  528. loadingDialog.value = true;
  529. proxy.post("/contractor/" + modalType.value, formData.data).then(
  530. () => {
  531. proxy.msgTip("操作成功", 1);
  532. dialogVisible.value = false;
  533. getList();
  534. },
  535. (err) => {
  536. console.log(err);
  537. loadingDialog.value = false;
  538. }
  539. );
  540. // if (
  541. // formData.data.accountRemainderList &&
  542. // formData.data.accountRemainderList.length > 0
  543. // ) {
  544. // if (isRepeat(formData.data.accountRemainderList)) {
  545. // return ElMessage("请勿重复添加货币余额");
  546. // } else {
  547. // loadingDialog.value = true;
  548. // proxy.post("/accountManagement/" + modalType.value, formData.data).then(
  549. // () => {
  550. // ElMessage({
  551. // message: modalType.value == "add" ? "添加成功" : "编辑成功",
  552. // type: "success",
  553. // });
  554. // dialogVisible.value = false;
  555. // getList();
  556. // },
  557. // (err) => {
  558. // console.log(err);
  559. // loadingDialog.value = false;
  560. // }
  561. // );
  562. // }
  563. // } else {
  564. // return ElMessage("请添加至少一条类型余额");
  565. // }
  566. });
  567. };
  568. const update = (row) => {
  569. loadingDialog.value = false;
  570. modalType.value = "edit";
  571. formData.data = proxy.deepClone(row);
  572. dialogVisible.value = true;
  573. };
  574. const clickUpdate = (row) => {
  575. proxy.$router.push({
  576. path: "/platform_manage/process/processApproval",
  577. query: {
  578. flowKey: "education_subsidy_flow",
  579. flowName: "学历补贴发起流程",
  580. random: proxy.random(),
  581. businessId: row.id,
  582. },
  583. });
  584. };
  585. const getDtl = (row) => {
  586. proxy.$router.push({
  587. path: "/platform_manage/process/processApproval",
  588. query: {
  589. flowKey: "education_subsidy_flow",
  590. flowName: "学历补贴流程查看",
  591. random: proxy.random(),
  592. businessId: row.id,
  593. processType: 20,
  594. },
  595. });
  596. };
  597. const changeDate = (settleStartDate, settleEndDate, id) => {
  598. if (settleStartDate && settleEndDate) {
  599. proxy
  600. .post("/contract/editSettleDateRange", {
  601. id,
  602. settleStartDate,
  603. settleEndDate,
  604. })
  605. .then((res) => {});
  606. }
  607. };
  608. </script>
  609. <style lang="scss" scoped>
  610. .tenant {
  611. padding: 20px;
  612. }
  613. ::v-deep(.el-input-number .el-input__inner) {
  614. text-align: left;
  615. }
  616. </style>