index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-row>
  5. <el-form-item label="地点" prop="fUpdateaddress">
  6. <el-input style="width: 240px" v-model="queryParams.fUpdateaddress" placeholder="请选择客户类别" clearable size="small">
  7. </el-input>
  8. </el-form-item>
  9. <el-form-item label="箱号" prop="fNo">
  10. <el-input
  11. v-model="queryParams.fNo"
  12. style="width: 240px"
  13. placeholder="请输入名称"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. </el-row>
  20. </el-form>
  21. <el-row :gutter="10" class="mb8">
  22. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  23. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  24. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  25. </el-row>
  26. <el-table @cell-click="modiEy" v-loading="loading" :data="corpsList" @selection-change="handleSelectionChange">
  27. <el-table-column type="selection" width="55" align="center" />
  28. <el-table-column type="index" width="55" label="行号" align="center" />
  29. <el-table-column
  30. v-for="(item,index) in boxDistributionName"
  31. :key="item.index"
  32. :label="item"
  33. :value="item.index"
  34. :prop="item"
  35. >
  36. </el-table-column>
  37. <!-- <el-table-column :show-overflow-tooltip="true" label="地点" align="center" prop="fTypename" width="200px"/>-->
  38. <!-- <el-table-column label="20GP" align="center" prop="fNo" width="100px"/>-->
  39. <!-- <el-table-column :show-overflow-tooltip="true" label="40GP" align="center" prop="fName" width="100px"-->
  40. <!-- />-->
  41. <!-- <el-table-column :show-overflow-tooltip="true" label="40HC" align="center" width="100px" prop="fCname" />-->
  42. <!-- <el-table-column :show-overflow-tooltip="true" label="40HR" align="center" prop="fEname" />-->
  43. <!-- <el-table-column :show-overflow-tooltip="true" label="空" align="center" prop="fTel" />-->
  44. <!-- <el-table-column label="重" align="center" prop="createBy" />-->
  45. <!-- <el-table-column label="好" align="center" prop="createTime" width="100"/>-->
  46. <!-- <el-table-column label="坏" align="center" prop="updateBy" width="100px"/>-->
  47. </el-table>
  48. <pagination
  49. v-show="total>0"
  50. :total="total"
  51. :page.sync="queryParams.pageNum"
  52. :limit.sync="queryParams.pageSize"
  53. @pagination="getList"
  54. />
  55. </div>
  56. </template>
  57. <script>
  58. import { listCorps, listName, getCorps, delCorps, changeCorpsStatus,exportCorps } from "@/api/kaihe/containerNews/boxDistribution";
  59. import {queryUserVal} from "@/api/system/user";
  60. import { isArray } from '@/utils/validate'
  61. import Vue from 'vue'
  62. export default {
  63. name: "boxDistribution",
  64. components: {
  65. },
  66. data() {
  67. return {
  68. //默认显示第一行
  69. queryParamsHidden:false,
  70. //标签名
  71. boxDistributionName:[],
  72. //全屏放大
  73. dialogFull:false,
  74. contactList:[],
  75. // 遮罩层
  76. loading: true,
  77. // 选中数组
  78. ids: [],
  79. // 非单个禁用
  80. single: true,
  81. // 非多个禁用
  82. multiple: true,
  83. // 显示搜索条件
  84. showSearch: true,
  85. // 总条数
  86. total: 0,
  87. // 客户详情表格数据
  88. corpsList: [],
  89. // 弹出层标题
  90. title: "",
  91. // 状态数据字典
  92. statusOptions: [],
  93. // 是否显示弹出层
  94. open: false,
  95. // 客户类别字典
  96. fTypeidOptions: [],
  97. // 结算表票结、月结字典
  98. fStltypeidOptions: [],
  99. // 删除状态字典
  100. delFlagOptions: [],
  101. // 查询参数
  102. queryParams: {
  103. pageNum: 1,
  104. pageSize: 10,
  105. fUpdateaddress:null,
  106. },
  107. // 表单参数
  108. form: {},
  109. // 表单校验
  110. rules: {
  111. fTypeid: [
  112. { required: true, message: "客户类别不能为空", trigger: "blur" }
  113. ],
  114. fNo: [
  115. { required: true, message: "编号不能为空", trigger: "blur" }
  116. ],
  117. fName: [
  118. { required: true, message: "名称不能为空", trigger: "blur" }
  119. ],
  120. fCname:[
  121. { required: true, message: "简称不能为空", trigger: "blur" }
  122. ],
  123. fStatus: [
  124. { required: true, message: "状态默认 T ,正常T 停用F 下拉选择不能为空", trigger: "blur" }
  125. ],
  126. }
  127. };
  128. },
  129. created() {
  130. this.getList();
  131. this.getDicts("data_customer_category").then(response => {
  132. this.fTypeidOptions = response.data;
  133. });
  134. this.getDicts("data_stltype_type").then(response => {
  135. this.fStltypeidOptions = response.data;
  136. });
  137. this.getDicts("data_delete_state").then(response => {
  138. this.delFlagOptions = response.data;
  139. });
  140. this.getDicts("sys_normal_disable").then(response => {
  141. this.statusOptions = response.data;
  142. });
  143. },
  144. methods: {
  145. modiEy(row, column, cell, event){
  146. // console.log(row)
  147. console.log(column)
  148. // console.log(cell)
  149. // console.log(event)
  150. // console.log(column.property)
  151. console.log(column.label)
  152. console.log(row["地点"])
  153. let res = {
  154. column:column.label,
  155. row:row["地点"]
  156. }
  157. this.$router.push({
  158. path: "/containerNews/modifyPage",
  159. query: { data: JSON.stringify(res) },
  160. });
  161. },
  162. full(){
  163. this.dialogFull = !this.dialogFull
  164. },
  165. // 客户类别默认为客户结算方式默认月结
  166. query() {
  167. this.$set(this.form, "fStltypeid", 1);
  168. },
  169. // 添加行
  170. addRow(tableData,event){
  171. var obj = {}
  172. tableData.push(obj)
  173. },
  174. //删除行
  175. deleteRow(index, rows) {
  176. rows.splice(index, 1);
  177. },
  178. /** 查询客户详情列表 */
  179. getList() {
  180. this.loading = true;
  181. listName().then(response =>{
  182. this.boxDistributionName = response.rows
  183. })
  184. listCorps(this.queryParams).then(response => {
  185. this.corpsList = response.rows;
  186. this.total = response.total;
  187. this.loading = false;
  188. });
  189. },
  190. // 客户类别字典翻译
  191. fTypeidFormat(row, column) {
  192. return this.selectDictLabel(this.fTypeidOptions, row.fTypeid);
  193. },
  194. // 结算表票结、月结字典翻译
  195. fStltypeidFormat(row, column) {
  196. return this.selectDictLabel(this.fStltypeidOptions, row.fStltypeid);
  197. },
  198. // 删除状态字典翻译
  199. delFlagFormat(row, column) {
  200. return this.selectDictLabel(this.delFlagOptions, row.delFlag);
  201. },
  202. // 取消按钮
  203. cancel() {
  204. this.open = false;
  205. this.reset();
  206. },
  207. // 表单重置
  208. reset() {
  209. this.form = {
  210. fId: null,
  211. fTypeid: null,
  212. fNo: null,
  213. fName: null,
  214. fCname: null,
  215. fEname: null,
  216. fTel: null,
  217. fFax: null,
  218. fEmail: null,
  219. fManage: null,
  220. fAddr: null,
  221. fEaddr: null,
  222. fScale: null,
  223. fProvince: null,
  224. fCity: null,
  225. fStltypeid: null,
  226. fStldays: null,
  227. fContractno: null,
  228. fContractb: null,
  229. fContracte: null,
  230. fTax: null,
  231. fInvtel: null,
  232. fInvaddr: null,
  233. fBankno: null,
  234. fBankname: null,
  235. fUbankno: null,
  236. fUbankname: null,
  237. fStatus: null,
  238. delFlag: null,
  239. createBy: null,
  240. createTime: null,
  241. updateBy: null,
  242. updateTime: null,
  243. remark: null
  244. };
  245. this.resetForm("form");
  246. },
  247. // 从表重置
  248. contList() {
  249. this.contactList = []
  250. },
  251. // 状态修改
  252. handleStatusChange(row) {
  253. let text = row.fStatus === "0" ? "启用" : "停用";
  254. this.$confirm('确认要"' + text + '""' + row.fName + '"吗?', "警告", {
  255. confirmButtonText: "确定",
  256. cancelButtonText: "取消",
  257. type: "warning"
  258. }).then(function() {
  259. return changeCorpsStatus(row.fId, row.fStatus);
  260. }).then(() => {
  261. this.msgSuccess(text + "成功");
  262. }).catch(function() {
  263. row.fStatus = row.fStatus === "0" ? "1" : "0";
  264. });
  265. },
  266. /** 搜索按钮操作 */
  267. handleQuery() {
  268. this.queryParams.pageNum = 1;
  269. this.getList();
  270. },
  271. /** 重置按钮操作 */
  272. resetQuery() {
  273. this.resetForm("queryForm");
  274. this.handleQuery();
  275. },
  276. // 多选框选中数据
  277. handleSelectionChange(selection) {
  278. this.ids = selection.map(item => item.fId)
  279. this.single = selection.length!==1
  280. this.multiple = !selection.length
  281. },
  282. /** 新增按钮操作 */
  283. handleAdd() {
  284. this.reset();
  285. this.query();
  286. this.contList();
  287. this.open = true;
  288. this.title = "添加客户详情";
  289. },
  290. /** 修改按钮操作 */
  291. handleUpdate(row) {
  292. this.reset();
  293. const fId = row.fId || this.ids
  294. getCorps(fId).then(response => {
  295. this.form = response.data["corp"];
  296. var contactList1=response.data["customerContact"];
  297. this.form.fTypeid = this.form.fTypeid.replace(/\[|]/g,'').replace(/\"/g, "").split(",")
  298. if(contactList1!=null){
  299. this.contactList=contactList1;
  300. }else {
  301. this.query();
  302. }
  303. this.open = true;
  304. this.title = "修改客户详情";
  305. });
  306. },
  307. /** 提交按钮 */
  308. submitForm() {
  309. this.form.fTypename = ''
  310. this.$refs["form"].validate(valid => {
  311. if (valid) {
  312. if (this.form.fId != null) {
  313. let formDate= new FormData()
  314. for (let index in this.fTypeidOptions){
  315. for (let item in this.form.fTypeid){
  316. if (this.fTypeidOptions[index].dictValue == this.form.fTypeid[item]){
  317. this.form.fTypename += this.fTypeidOptions[index].dictLabel + ','
  318. }
  319. }
  320. }
  321. this.form.fTypename = this.form.fTypename.substring(0,this.form.fTypename.length-1)
  322. formDate.append('corps',JSON.stringify(this.form));
  323. formDate.append('customerContacts',JSON.stringify(this.contactList));
  324. addCorps(formDate).then(response => {
  325. this.msgSuccess("修改成功");
  326. this.open = false;
  327. this.getList();
  328. });
  329. } else {
  330. let formDate= new FormData()
  331. for (let index in this.fTypeidOptions){
  332. for (let item in this.form.fTypeid){
  333. if (this.fTypeidOptions[index].dictValue == this.form.fTypeid[item]){
  334. this.form.fTypename += this.fTypeidOptions[index].dictLabel + ','
  335. }
  336. }
  337. }
  338. this.form.fTypename = this.form.fTypename.substring(0,this.form.fTypename.length-1)
  339. formDate.append('corps',JSON.stringify(this.form));
  340. formDate.append('customerContacts',JSON.stringify(this.contactList));
  341. addCorps(formDate).then(response => {
  342. this.msgSuccess("新增成功");
  343. this.open = false;
  344. this.getList();
  345. });
  346. }
  347. }
  348. });
  349. },
  350. /** 删除按钮操作 */
  351. handleDelete(row) {
  352. const fIds = row.fId || this.ids;
  353. this.$confirm('是否确认删除客户详情编号为"' + fIds + '"的数据项?', "警告", {
  354. confirmButtonText: "确定",
  355. cancelButtonText: "取消",
  356. type: "warning"
  357. }).then(function() {
  358. return delCorps(fIds);
  359. }).then(() => {
  360. this.getList();
  361. this.msgSuccess("删除成功");
  362. })
  363. },
  364. /** 导出按钮操作 */
  365. handleExport() {
  366. const queryParams = this.queryParams;
  367. this.$confirm('是否确认导出所有客户详情数据项?', "警告", {
  368. confirmButtonText: "确定",
  369. cancelButtonText: "取消",
  370. type: "warning"
  371. }).then(function() {
  372. return exportCorps(queryParams);
  373. }).then(response => {
  374. this.download(response.msg);
  375. })
  376. }
  377. }
  378. };
  379. </script>
  380. <style lang="scss">
  381. .avue-crud__dialog__header {
  382. display: -webkit-box;
  383. display: -ms-flexbox;
  384. display: flex;
  385. -webkit-box-align: center;
  386. -ms-flex-align: center;
  387. align-items: center;
  388. -webkit-box-pack: justify;
  389. -ms-flex-pack: justify;
  390. justify-content: space-between;
  391. }
  392. .el-dialog__title {
  393. color: rgba(0,0,0,.85);
  394. font-weight: 500;
  395. word-wrap: break-word;
  396. }
  397. .avue-crud__dialog__menu {
  398. padding-right: 20px;
  399. float: left;
  400. }
  401. .avue-crud__dialog__menu i {
  402. color: #909399;
  403. font-size: 15px;
  404. }
  405. .el-icon-full-screen{
  406. cursor: pointer;
  407. }
  408. .el-icon-full-screen:before {
  409. content: "\e719";
  410. }
  411. </style>