logistics_list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选条件 -->
  4. <div>
  5. <el-form
  6. ref="screenForm"
  7. :model="screenForm"
  8. label-width="120px"
  9. size="mini"
  10. label-position="left"
  11. >
  12. <el-row :gutter="20">
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="物流公司名称" prop="customerTel">
  15. <el-input
  16. placeholder="请输入物流公司名称"
  17. v-model="screenForm.logisticsCompany"
  18. ></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="6">
  22. <el-form-item label="客服电话" prop="logisticsCompany">
  23. <el-input
  24. placeholder="请输入客服电话"
  25. v-model="screenForm.customerTel "
  26. ></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :xs="24" :sm="12" :lg="12" class="tr">
  30. <el-form-item label="">
  31. <el-button size="mini" @click="resetScreenForm">清空</el-button>
  32. <el-button size="mini" type="primary" @click="submitScreenForm"
  33. >搜索</el-button
  34. >
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. </el-form>
  39. </div>
  40. <!-- 按钮 -->
  41. <div class="btn-group clearfix">
  42. <div class="fl">
  43. <el-button type="primary" icon="el-icon-plus" size="mini" @click="hanleAdd" v-if="$checkBtnRole('add', $route.meta.roles)"
  44. >新增</el-button
  45. >
  46. <el-popconfirm
  47. v-if="$checkBtnRole('del', $route.meta.roles)"
  48. confirm-button-text="好的"
  49. cancel-button-text="不用了"
  50. icon="el-icon-info"
  51. icon-color="red"
  52. title="内容确定删除吗?"
  53. @onConfirm="hanleDelete"
  54. >
  55. <el-button
  56. type="primary"
  57. size="mini"
  58. slot="reference"
  59. class="el-popover-left"
  60. >删除</el-button
  61. >
  62. </el-popconfirm>
  63. </div>
  64. <div class="fr">
  65. <!-- <ExportButton :exUrl="'/logistics/export'" :exParams="exParams" /> -->
  66. <el-button type="primary" size="mini" @click="handleExport"
  67. >导出</el-button
  68. >
  69. <!-- <el-button type="primary" size="mini" @click="hanlePrint"
  70. >打印</el-button
  71. > -->
  72. </div>
  73. </div>
  74. <!-- 列表 -->
  75. <div class="mymain-container">
  76. <div class="table">
  77. <el-table
  78. v-loading="listLoading"
  79. :data="dataList"
  80. element-loading-text="Loading"
  81. @select="hanleSelectAll"
  82. @select-all="hanleSelectAll"
  83. border
  84. fit
  85. highlight-current-row
  86. stripe
  87. >
  88. <el-table-column type="selection" align="center"></el-table-column>
  89. <el-table-column
  90. align="center"
  91. label="物流公司名称"
  92. prop="logisticsCompany"
  93. min-width="160"
  94. show-overflow-tooltip
  95. >
  96. </el-table-column>
  97. <el-table-column
  98. align="center"
  99. label="物流公司代码"
  100. prop="logisticsNumber"
  101. min-width="160"
  102. show-overflow-tooltip
  103. >
  104. </el-table-column>
  105. <el-table-column
  106. align="center"
  107. label="提货人"
  108. prop="pickName"
  109. min-width="160"
  110. show-overflow-tooltip
  111. >
  112. </el-table-column>
  113. <el-table-column
  114. align="center"
  115. label="提货人电话"
  116. prop="pickTel"
  117. min-width="160"
  118. show-overflow-tooltip
  119. >
  120. </el-table-column>
  121. <el-table-column
  122. align="center"
  123. label="客服电话"
  124. prop="customerTel"
  125. min-width="160"
  126. show-overflow-tooltip
  127. >
  128. </el-table-column>
  129. <el-table-column
  130. align="center"
  131. label="创建人"
  132. prop="createBy"
  133. min-width="160"
  134. show-overflow-tooltip
  135. >
  136. </el-table-column>
  137. <el-table-column
  138. align="center"
  139. label="创建时间"
  140. prop="createTime"
  141. min-width="160"
  142. show-overflow-tooltip
  143. >
  144. </el-table-column>
  145. <el-table-column
  146. align="center"
  147. label="更新人"
  148. prop="updateBy"
  149. min-width="160"
  150. show-overflow-tooltip
  151. >
  152. </el-table-column>
  153. <el-table-column
  154. align="center"
  155. label="更新时间"
  156. prop="updateTime"
  157. min-width="160"
  158. show-overflow-tooltip
  159. >
  160. </el-table-column>
  161. <el-table-column
  162. align="center"
  163. label="操作"
  164. min-width="160"
  165. show-overflow-tooltip
  166. >
  167. <template slot-scope="scope">
  168. <!-- <el-button
  169. type="text"
  170. class="textColor"
  171. @click="hanleDetail(scope.row)"
  172. >详情</el-button
  173. > -->
  174. <el-button
  175. type="text"
  176. v-if="$checkBtnRole('edit', $route.meta.roles)"
  177. class="textColor"
  178. @click="editFn(scope.row.id, scope.row)"
  179. >编辑</el-button
  180. >
  181. <el-popconfirm
  182. v-if="$checkBtnRole('del', $route.meta.roles)"
  183. confirm-button-text="好的"
  184. cancel-button-text="不用了"
  185. icon="el-icon-info"
  186. icon-color="red"
  187. title="内容确定删除吗?"
  188. @onConfirm="hanleDelete(scope.row.id)"
  189. >
  190. <el-button
  191. slot="reference"
  192. type="text"
  193. class="textColor el-popover-left"
  194. >删除</el-button
  195. >
  196. </el-popconfirm>
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. </div>
  201. <!-- 分页 -->
  202. <div class="fr">
  203. <el-pagination
  204. @size-change="handleSizeChange"
  205. @current-change="handleCurrentChange"
  206. :current-page="currentPage"
  207. :page-sizes="[10, 20, 30, 50]"
  208. :page-size="10"
  209. layout="total, sizes, prev, pager, next, jumper"
  210. :total="listTotal"
  211. >
  212. </el-pagination>
  213. </div>
  214. </div>
  215. <!-- 弹窗 -->
  216. <el-dialog
  217. title="提货车辆档案"
  218. :visible.sync="showDialogForm"
  219. width="50%"
  220. :show-close="false"
  221. :close-on-click-modal="false"
  222. >
  223. <el-form
  224. ref="form"
  225. :rules="type == 2 ? rules : ''"
  226. :model="diaLogForm"
  227. label-width="120px"
  228. >
  229. <el-form-item label="物流公司名称" prop="logisticsCompany">
  230. <el-input v-model="diaLogForm.logisticsCompany"></el-input>
  231. </el-form-item>
  232. <el-form-item label="物流公司代码" prop="logisticsNumber">
  233. <el-input v-model="diaLogForm.logisticsNumber"></el-input>
  234. </el-form-item>
  235. <el-form-item label="提货人" prop="pickName">
  236. <el-input v-model="diaLogForm.pickName"></el-input>
  237. </el-form-item>
  238. <el-form-item label="提货人电话" prop="pickTel">
  239. <el-input v-model="diaLogForm.pickTel"></el-input>
  240. </el-form-item>
  241. <el-form-item label="客服电话" prop="customerTel">
  242. <el-input v-model="diaLogForm.customerTel"></el-input>
  243. </el-form-item>
  244. </el-form>
  245. <div slot="footer" class="dialog-footer">
  246. <el-button @click="hanleCancel('form')">取 消</el-button>
  247. <el-button type="primary" @click="handelInfo('form')">确 定</el-button>
  248. </div>
  249. </el-dialog>
  250. </div>
  251. </template>
  252. <script>
  253. import Mixin from '@/mixin/index'
  254. import { addInof, deleteInfo, getLogisticsList, updateInfo } from '@/api/basic_data/logistics'
  255. import { downloadFiles } from '@/utils/util'
  256. export default {
  257. mixins: [Mixin],
  258. data() {
  259. return {
  260. type: 1, // 1 ,2, 3
  261. diaLogForm: {
  262. id: null,
  263. customerTel: "",
  264. logisticsCompany: "",
  265. logisticsNumber: "",
  266. pickName: "",
  267. pickTel: "",
  268. },
  269. showDialogForm: false,
  270. screenForm: {
  271. name: "",
  272. username: "",
  273. telephone: "",
  274. customerTel: "",
  275. logisticsCompany: "",
  276. },
  277. ids: [],
  278. rules: {
  279. logisticsCompany: [
  280. { required: true, message: "请输入物流公司名称", trigger: "blur" },
  281. ],
  282. logisticsNumber: [
  283. { required: true, message: "请输入物流公司代码", trigger: "blur" },
  284. ],
  285. pickName: [
  286. { required: true, message: "请输入提货人", trigger: "blur" },
  287. ],
  288. pickTel: [
  289. { required: true, message: "请输入提货人电话", trigger: "blur" },
  290. ],
  291. customerTel: [
  292. { required: true, message: "请输入客服电话", trigger: "blur" },
  293. ],
  294. },
  295. };
  296. },
  297. methods: {
  298. //显示新增弹框
  299. hanleAdd() {
  300. this.type = 2;
  301. this.showDialogForm = true;
  302. },
  303. //显示编辑,编辑数据初始化
  304. editFn(id, row) {
  305. this.type = 1;
  306. this.diaLogForm = {
  307. id,
  308. customerTel: row.customerTel,
  309. logisticsCompany: row.logisticsCompany,
  310. logisticsNumber: row.logisticsNumber,
  311. pickName: row.pickName,
  312. pickTel: row.pickTel,
  313. };
  314. this.showDialogForm = true;
  315. },
  316. // 初始化数据
  317. getList() {
  318. this.listLoading = true;
  319. let params = {
  320. pageNum: this.currentPage,
  321. pageSize: this.pageSize,
  322. customerTel: this.screenForm.customerTel,
  323. logisticsCompany: this.screenForm.logisticsCompany,
  324. };
  325. getLogisticsList(params).then((res) => {
  326. this.dataList = res.data.records;
  327. this.listTotal = res.data.total;
  328. this.listLoading = false;
  329. console.log(this.dataList, 1233);
  330. });
  331. },
  332. //新增数据或者编辑数据请求接口 type 1 为编辑 type 2 新增
  333. handelInfo(formName) {
  334. if (this.type === 1) {
  335. const params = {
  336. ...this.diaLogForm,
  337. };
  338. updateInfo(params).then((res) => {
  339. this.$successMsg("编辑成功");
  340. this.showDialogForm = false;
  341. this.getList();
  342. this.hanleCancel();
  343. });
  344. this.diaLogForm.id = null;
  345. } else if (this.type === 2) {
  346. this.$refs[formName].validate((valid) => {
  347. if (valid) {
  348. addInof(this.diaLogForm).then((res) => {
  349. this.$successMsg("保存成功");
  350. this.showDialogForm = false;
  351. this.hanleCancel();
  352. this.getList();
  353. });
  354. } else {
  355. console.log("error submit!!");
  356. return false;
  357. }
  358. });
  359. } else {
  360. this.showDialogForm = false;
  361. }
  362. },
  363. //查看详情
  364. hanleDetail(detail) {
  365. this.type = 3;
  366. this.showDialogForm = true;
  367. this.diaLogForm = detail;
  368. this.hanleCancel();
  369. },
  370. // 导出文档
  371. handleExport() {
  372. let screenData = {
  373. customerTel: this.diaLogForm.customerTel,
  374. logisticsCompany: this.diaLogForm.logisticsCompany,
  375. };
  376. downloadFiles("/logistics/export", screenData);
  377. },
  378. // 删除数据
  379. hanleDelete(id) {
  380. this.hanleDeleteAllPromise(id).then((ids) => {
  381. deleteInfo(ids).then(() => {
  382. this.$successMsg("删除成功");
  383. this.getList();
  384. });
  385. });
  386. },
  387. // 取消按钮重置数据
  388. hanleCancel(form) {
  389. this.$refs['form'].resetFields()
  390. // this.diaLogForm = {
  391. // id: null,
  392. // customerTel: "",
  393. // logisticsCompany: "",
  394. // logisticsNumber: "",
  395. // pickName: "",
  396. // pickTel: "",
  397. // };
  398. this.showDialogForm = false;
  399. },
  400. },
  401. };
  402. </script>
  403. <style lang="scss" scoped>
  404. .textColor {
  405. color: black;
  406. }
  407. ::v-deep .el-date-editor {
  408. width: 100%;
  409. }
  410. ::v-deep .el-select {
  411. width: 100%;
  412. }
  413. ::v-deep .el-col-9 .el-button {
  414. padding: 5px;
  415. }
  416. ::v-deep .el-dialog__header {
  417. background-color: #dddddd;
  418. }
  419. .base {
  420. padding: 20px 20px 0;
  421. }
  422. .table {
  423. margin-top: 12px;
  424. }
  425. .right {
  426. float: right;
  427. }
  428. </style>