index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="68px"
  10. >
  11. <el-form-item label="通知单号" prop="noticeNumber">
  12. <el-input
  13. v-model="queryParams.noticeNumber"
  14. placeholder="请输入通知单号"
  15. clearable
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="日期" prop="noticeDate">
  20. <el-date-picker
  21. clearable
  22. v-model="queryParams.noticeDate"
  23. type="date"
  24. value-format="yyyy-MM-dd"
  25. placeholder="请选择通知日期"
  26. >
  27. </el-date-picker>
  28. </el-form-item>
  29. <!-- <el-form-item label="状态" prop="status">
  30. <el-select
  31. v-model="queryParams.status"
  32. value-key=""
  33. placeholder=""
  34. clearable
  35. filterable
  36. @change=""
  37. >
  38. <el-option
  39. v-for="item in options"
  40. :key="item.value"
  41. :label="item.label"
  42. :value="item.value"
  43. >
  44. </el-option>
  45. </el-select>
  46. </el-form-item> -->
  47. <el-form-item label="客户" prop="customerId">
  48. <!-- <el-input
  49. v-model="queryParams.customerId"
  50. placeholder="请输入客户编号"
  51. clearable
  52. @keyup.enter.native="handleQuery"
  53. /> -->
  54. <el-select
  55. v-model="queryParams.customerId"
  56. placeholder="请选择客户"
  57. clearable
  58. filterable
  59. @change="handleQuery"
  60. >
  61. <el-option
  62. v-for="item in customerOptions"
  63. :key="item.id"
  64. :label="item.customName"
  65. :value="item.id"
  66. >
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item>
  71. <el-button
  72. type="primary"
  73. icon="el-icon-search"
  74. size="mini"
  75. @click="handleQuery"
  76. >搜索</el-button
  77. >
  78. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  79. >重置</el-button
  80. >
  81. </el-form-item>
  82. </el-form>
  83. <el-row :gutter="10" class="mb8">
  84. <!-- <el-col :span="1.5">
  85. <el-button
  86. type="primary"
  87. plain
  88. icon="el-icon-plus"
  89. size="mini"
  90. @click="handleAdd"
  91. v-hasPermi="['system:ProductInvoice:add']"
  92. >新增</el-button
  93. >
  94. </el-col>
  95. <el-col :span="1.5">
  96. <el-button
  97. type="success"
  98. plain
  99. icon="el-icon-edit"
  100. size="mini"
  101. :disabled="single"
  102. @click="handleUpdate"
  103. v-hasPermi="['system:ProductInvoice:edit']"
  104. >修改</el-button
  105. >
  106. </el-col>
  107. <el-col :span="1.5">
  108. <el-button
  109. type="danger"
  110. plain
  111. icon="el-icon-delete"
  112. size="mini"
  113. :disabled="multiple"
  114. @click="handleDelete"
  115. v-hasPermi="['system:ProductInvoice:remove']"
  116. >删除</el-button
  117. >
  118. </el-col>
  119. <el-col :span="1.5">
  120. <el-button
  121. type="warning"
  122. plain
  123. icon="el-icon-download"
  124. size="mini"
  125. @click="handleExport"
  126. v-hasPermi="['system:ProductInvoice:export']"
  127. >导出</el-button
  128. >
  129. </el-col> -->
  130. <right-toolbar
  131. :showSearch.sync="showSearch"
  132. @queryTable="getList"
  133. ></right-toolbar>
  134. </el-row>
  135. <el-table
  136. v-loading="loading"
  137. :data="ProductInvoiceList"
  138. @selection-change="handleSelectionChange"
  139. >
  140. <!-- <el-table-column label="编号" align="center" prop="id" />
  141. -->
  142. <el-table-column
  143. label="日期"
  144. align="center"
  145. prop="noticeDate"
  146. width="180"
  147. >
  148. <template slot-scope="scope">
  149. <span>{{ parseTime(scope.row.noticeDate, "{y}-{m}-{d}") }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="通知单号" align="center" prop="noticeNumber" />
  153. <!-- <el-table-column label="销售员" align="center" prop="salesman" />
  154. <el-table-column label="客户编号" align="center" prop="customerId" />
  155. <el-table-column label="开票员" align="center" prop="drawer" />
  156. <el-table-column
  157. label="发货单备注"
  158. align="center"
  159. prop="dispatchNoteRemark"
  160. /> -->
  161. <!-- <el-table-column label="开票类型" align="center" prop="billingType" />
  162. <el-table-column
  163. label="货车登记"
  164. align="center"
  165. prop="truckRegistration"
  166. />
  167. <el-table-column label="单据类型" align="center" prop="documentType" />
  168. <el-table-column label="售货单位" align="center" prop="sellingUnit" />
  169. <el-table-column label="计算类型" align="center" prop="calculationType" />
  170. <el-table-column label="审核意见" align="center" prop="auditOpinion" /> -->
  171. <el-table-column label="客户名称" align="center" prop="customerName" />
  172. <el-table-column label="状态" align="center" prop="status">
  173. <template slot-scope="scope">{{ scope.row.status }}</template>
  174. </el-table-column>
  175. <!-- <el-table-column label="销售单合同号" align="center" prop="saleOrderNo" />
  176. <el-table-column label="备注" align="center" prop="remark" /> -->
  177. <el-table-column
  178. label="操作"
  179. align="center"
  180. class-name="small-padding fixed-width"
  181. >
  182. <template slot-scope="scope">
  183. <el-dropdown>
  184. <el-button type="warning" plain size="small">
  185. 处理<i class="el-icon-arrow-down el-icon--right"></i>
  186. </el-button>
  187. <el-dropdown-menu slot="dropdown">
  188. <!-- <el-dropdown-item>
  189. <el-button
  190. type="text"
  191. size="mini"
  192. @click="handleDeliverOrder(scope.$index, scope.row)"
  193. >打印发货单</el-button
  194. >
  195. </el-dropdown-item> -->
  196. <el-dropdown-item>
  197. <el-button
  198. type="text"
  199. size="mini"
  200. @click="handleSendOrder(scope.$index, scope.row)"
  201. >打印对账单</el-button
  202. >
  203. </el-dropdown-item>
  204. </el-dropdown-menu>
  205. </el-dropdown>
  206. </template>
  207. </el-table-column>
  208. </el-table>
  209. <pagination
  210. v-show="total > 0"
  211. :total="total"
  212. :page.sync="queryParams.pageNum"
  213. :limit.sync="queryParams.pageSize"
  214. @pagination="getList"
  215. />
  216. <div id="printDom"></div>
  217. </div>
  218. </template>
  219. <script>
  220. import {
  221. listProductInvoice,
  222. getProductInvoice,
  223. delProductInvoice,
  224. addProductInvoice,
  225. updateProductInvoice,
  226. } from "@/api/system/ProductInvoice";
  227. import deliverOrderPrint from "@/utils/print/deliverOrderPrint";
  228. import sendOrderPrint from "@/utils/print/sendOrderPrint";
  229. import {
  230. productInvoiceInfo,
  231. queryDropDownBoxData,
  232. } from "@/api/tablelist/commonTable";
  233. import { mapState } from "vuex";
  234. export default {
  235. name: "ProductInvoice",
  236. data() {
  237. return {
  238. customerOptions: [],
  239. // 遮罩层
  240. loading: true,
  241. // 选中数组
  242. ids: [],
  243. // 非单个禁用
  244. single: true,
  245. // 非多个禁用
  246. multiple: true,
  247. // 显示搜索条件
  248. showSearch: true,
  249. // 总条数
  250. total: 0,
  251. // 产品发货单表格数据
  252. ProductInvoiceList: [],
  253. // 弹出层标题
  254. title: "",
  255. // 是否显示弹出层
  256. open: false,
  257. // 查询参数
  258. queryParams: {
  259. pageNum: 1,
  260. pageSize: 10,
  261. noticeNumber: null,
  262. noticeDate: null,
  263. salesman: null,
  264. customerId: null,
  265. drawer: null,
  266. dispatchNoteRemark: null,
  267. billingType: null,
  268. truckRegistration: null,
  269. documentType: null,
  270. sellingUnit: null,
  271. calculationType: null,
  272. auditOpinion: null,
  273. status: 2,
  274. },
  275. // 表单参数
  276. form: {},
  277. // 表单校验
  278. rules: {},
  279. };
  280. },
  281. created() {
  282. this.getList();
  283. },
  284. computed: {
  285. ...mapState({
  286. username: (state) => state.user.name,
  287. }),
  288. },
  289. methods: {
  290. // 初始化下拉框数据
  291. async initDropDownBoxData() {
  292. try {
  293. let res = await queryDropDownBoxData([
  294. {
  295. basicMap: {
  296. tableName: "customer",
  297. },
  298. },
  299. ]);
  300. if (res.code == 200) {
  301. console.log(res);
  302. this.customerOptions = res.data.resultMap.customer;
  303. } else {
  304. throw new Error(res);
  305. }
  306. } catch (error) {
  307. console.log(error);
  308. }
  309. },
  310. // 打印发货单回调
  311. async handleDeliverOrder(index, row) {
  312. let { saleOrderNo } = row;
  313. if (!saleOrderNo) {
  314. this.$message.error("数据异常,暂无saleOrderNo");
  315. }
  316. let payload = {
  317. saleOrderNo: saleOrderNo,
  318. };
  319. let res = await productInvoiceInfo(payload);
  320. if (res.code == 200) {
  321. let printData = res.data;
  322. console.log("printData", {
  323. ...row,
  324. ...printData,
  325. printUser: this.username,
  326. });
  327. deliverOrderPrint(
  328. { ...row, ...printData, printUser: this.username },
  329. "printDom"
  330. );
  331. } else {
  332. console.log(res);
  333. this.$message.error(res.msg);
  334. }
  335. // deliverOrderPrint(row, "printDom");
  336. },
  337. // 打印送货单回调
  338. async handleSendOrder(index, row) {
  339. let { saleOrderNo } = row;
  340. if (!saleOrderNo) {
  341. this.$message.error("数据异常,暂无saleOrderNo");
  342. }
  343. let payload = {
  344. saleOrderNo: saleOrderNo,
  345. };
  346. let res = await productInvoiceInfo(payload);
  347. if (res.code == 200) {
  348. let printData = res.data;
  349. console.log("printData", {
  350. ...row,
  351. ...printData,
  352. printUser: this.username,
  353. });
  354. sendOrderPrint(
  355. { ...row, ...printData, printUser: this.username },
  356. "printDom"
  357. );
  358. } else {
  359. console.log(res);
  360. this.$message.error(res.msg);
  361. }
  362. },
  363. /** 查询产品发货单列表 */
  364. getList() {
  365. this.loading = true;
  366. listProductInvoice(this.queryParams).then((response) => {
  367. this.ProductInvoiceList = response.rows;
  368. this.total = response.total;
  369. this.loading = false;
  370. });
  371. },
  372. // 取消按钮
  373. cancel() {
  374. this.open = false;
  375. this.reset();
  376. },
  377. // 表单重置
  378. reset() {
  379. this.form = {
  380. id: null,
  381. noticeNumber: null,
  382. noticeDate: null,
  383. salesman: null,
  384. customerId: null,
  385. drawer: null,
  386. dispatchNoteRemark: null,
  387. billingType: null,
  388. truckRegistration: null,
  389. documentType: null,
  390. sellingUnit: null,
  391. calculationType: null,
  392. auditOpinion: null,
  393. status: null,
  394. saleOrderNo: null,
  395. spare1: null,
  396. spare2: null,
  397. spare3: null,
  398. spare4: null,
  399. remark: null,
  400. delFlag: null,
  401. createBy: null,
  402. createById: null,
  403. createTime: null,
  404. updateBy: null,
  405. updateById: null,
  406. updateTime: null,
  407. };
  408. this.resetForm("form");
  409. },
  410. /** 搜索按钮操作 */
  411. handleQuery() {
  412. this.queryParams.pageNum = 1;
  413. this.getList();
  414. },
  415. /** 重置按钮操作 */
  416. resetQuery() {
  417. this.resetForm("queryForm");
  418. this.handleQuery();
  419. },
  420. // 多选框选中数据
  421. handleSelectionChange(selection) {
  422. this.ids = selection.map((item) => item.id);
  423. this.single = selection.length !== 1;
  424. this.multiple = !selection.length;
  425. },
  426. /** 新增按钮操作 */
  427. handleAdd() {
  428. this.reset();
  429. this.open = true;
  430. this.title = "添加产品发货单";
  431. },
  432. /** 修改按钮操作 */
  433. handleUpdate(row) {
  434. this.reset();
  435. const id = row.id || this.ids;
  436. getProductInvoice(id).then((response) => {
  437. this.form = response.data;
  438. this.open = true;
  439. this.title = "修改产品发货单";
  440. });
  441. },
  442. /** 提交按钮 */
  443. submitForm() {
  444. this.$refs["form"].validate((valid) => {
  445. if (valid) {
  446. if (this.form.id != null) {
  447. updateProductInvoice(this.form).then((response) => {
  448. this.$modal.msgSuccess("修改成功");
  449. this.open = false;
  450. this.getList();
  451. });
  452. } else {
  453. addProductInvoice(this.form).then((response) => {
  454. this.$modal.msgSuccess("新增成功");
  455. this.open = false;
  456. this.getList();
  457. });
  458. }
  459. }
  460. });
  461. },
  462. /** 删除按钮操作 */
  463. handleDelete(row) {
  464. const ids = row.id || this.ids;
  465. this.$modal
  466. .confirm('是否确认删除产品发货单编号为"' + ids + '"的数据项?')
  467. .then(function () {
  468. return delProductInvoice(ids);
  469. })
  470. .then(() => {
  471. this.getList();
  472. this.$modal.msgSuccess("删除成功");
  473. })
  474. .catch(() => {});
  475. },
  476. /** 导出按钮操作 */
  477. handleExport() {
  478. this.download(
  479. "system/ProductInvoice/export",
  480. {
  481. ...this.queryParams,
  482. },
  483. `ProductInvoice_${new Date().getTime()}.xlsx`
  484. );
  485. },
  486. },
  487. mounted() {
  488. this.initDropDownBoxData();
  489. },
  490. };
  491. </script>