clientList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <div class="app-container">
  3. <addressdny @getAdress="getAdress" ref="address"></addressdny>
  4. <div class="filter-container">
  5. <el-input size="mini" @input="searchData()" v-model="search.keyWord" placeholder="关键字" style="width: 200px;"
  6. class="filter-item" @keyup.enter.native="searchData"/>
  7. <el-button size="mini" class="filter-item" type="primary" icon="el-icon-search" @click="searchData">
  8. 搜索
  9. </el-button>
  10. <el-button
  11. size="mini"
  12. v-if="webType && isChoose == false"
  13. class="filter-item"
  14. style="margin-left: 10px;"
  15. type="primary"
  16. icon="el-icon-plus"
  17. @click="$router.push({path:'/doc/createCustomer'})">
  18. 增加客户
  19. </el-button>
  20. <el-checkbox v-if="!isChoose" size="mini" @change="checkDisable" v-model="disableLock" label="已禁用"
  21. border></el-checkbox>
  22. <el-button type="primary" size="mini" icon="el-icon-refresh" @click="getTableInfo">刷新</el-button>
  23. </div>
  24. <el-table
  25. size="mini"
  26. :data="tableData"
  27. v-loading="listLoading"
  28. style="width: 100%;margin-bottom: 20px;"
  29. row-key="id"
  30. tooltip-effect="light"
  31. :size="!webType || isChoose ? 'mini':''"
  32. border
  33. default-expand-all>
  34. <el-table-column label="操作" align="center" :width="webType&&!isChoose?'150':'100'"
  35. class-name="small-padding fixed-width">
  36. <template slot-scope="{row}">
  37. <template v-if="webType">
  38. <template v-if="!isChoose">
  39. <el-button
  40. @click="$router.push({path:'/doc/editCustomer/'+row.id,query:{id:row.id,clientName:row.clientName}})"
  41. type="primary" size="mini">
  42. 编辑
  43. </el-button>
  44. <el-button @click="editStatus(row.id,'0')" type="danger" v-if="row.enable==1" size="mini">
  45. 禁用
  46. </el-button>
  47. <el-button @click="editStatus(row.id,'1')" v-else-if="row.enable==0" size="mini">
  48. 启用
  49. </el-button>
  50. <!-- <el-button size="mini" @click="carEditOrderAddr(row.id,row.clientName)" type="primary">配置收货地址-->
  51. <!-- </el-button>-->
  52. </template>
  53. <template v-else>
  54. <el-button @click="sourceType == 1? chooseThisTo(row):chooseThis(row)" type="primary" size="mini">
  55. 选择
  56. </el-button>
  57. </template>
  58. </template>
  59. <template v-else>
  60. <el-button @click="ERPChoose(row)" type="primary" size="mini">
  61. 选择
  62. </el-button>
  63. </template>
  64. </template>
  65. </el-table-column>
  66. <template v-if="!isChoose || !webType">
  67. <el-table-column align="center" label="状态" class-name="status-col" width="100">
  68. <template slot-scope="{row}">
  69. <el-tag v-if="row.enable==1" type="success">
  70. 启用
  71. </el-tag>
  72. <el-tag v-else-if="row.enable==0" type="danger">
  73. 禁用
  74. </el-tag>
  75. </template>
  76. </el-table-column>
  77. </template>
  78. <el-table-column
  79. width="150px"
  80. prop="clientName"
  81. show-overflow-tooltip
  82. label="客户名称">
  83. <template slot-scope="{row}">
  84. <span class="ellipsis"> {{ row.clientName }}</span>
  85. </template>
  86. </el-table-column>
  87. <template>
  88. <el-table-column
  89. width="90px"
  90. prop="contactMan"
  91. show-overflow-tooltip
  92. label="联系人">
  93. <template slot-scope="{row}">
  94. <span class="ellipsis"> {{ row.contactMan }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column
  98. width="150"
  99. prop="contactPhone"
  100. label="联系电话">
  101. </el-table-column>
  102. <el-table-column
  103. align="left"
  104. class-name="status-col"
  105. width="388px"
  106. show-overflow-tooltip
  107. label="联系地址">
  108. <template slot-scope="{row}">
  109. <span class="ellipsis"><span v-if="row.province">{{ row.province }}</span><span
  110. v-if="row.city">{{ row.city }}</span><span v-if="row.area">{{ row.area }}</span><span v-if="row.address">{{ row.address }}</span></span>
  111. </template>
  112. </el-table-column>
  113. </template>
  114. </el-table>
  115. <pagination
  116. v-show="listData.total>0"
  117. :total="listData.total"
  118. :page.sync="listData.page"
  119. :limit.sync="listData.pageSize"
  120. @pagination="getTableInfo"/>
  121. <cancledialog @tableRefresh="tableRefresh" ref="confirmDialog"></cancledialog>
  122. </div>
  123. </template>
  124. <script>
  125. import { getInfo } from '@/api/doc/client/client.js'
  126. import Cancledialog from '@/components/Dialog/Cancledialog.vue'
  127. import Pagination from '@/components/Pagination'
  128. import Addressdny from '@/components/Dialog/Addressdny.vue'
  129. import 'vue-area-linkage/dist/index.css'
  130. import { pca, pcaa } from 'area-data'
  131. import { CodeToText, regionData } from 'element-china-area-data'
  132. export default {
  133. name: 'ClientList',
  134. components: {
  135. Cancledialog, Pagination, Addressdny
  136. },
  137. props: {
  138. isChoose: {
  139. type: Boolean,
  140. default: false
  141. },
  142. /**
  143. * 调用来源
  144. * 0 普通调用
  145. * 1 查询统计调用
  146. */
  147. sourceType: {
  148. type: Number,
  149. default: 0
  150. }
  151. },
  152. data() {
  153. return {
  154. invoicePhone: '',
  155. invoiceAddress: '',
  156. bankName: '',
  157. taxNum: '',
  158. billId: '',
  159. billTitle: '新增发票抬头',
  160. dialogStatusBill: 1,//1增加,2修改
  161. invoiceTitle: '',
  162. innerVisible: false,
  163. idClientRow: '',
  164. gridData: [],//发票抬头列表
  165. billDialog: false,
  166. selectedOptions: [],
  167. options: regionData, // 地址地区信息
  168. webType: true,
  169. cityshow: false,
  170. selected: [], // 省市区
  171. pca: pca,
  172. pcaa: pcaa,
  173. byId: '',
  174. dialogStatus: 1, // 1增加,2修改
  175. dialogTitle: '',
  176. dialogVisible: false,
  177. disableLock: false,
  178. search: {
  179. keyWord: ''
  180. },
  181. ruleForm: {},
  182. paytypeList: [],
  183. industryList: [],
  184. levelList: [],
  185. rules: {
  186. industryName: [
  187. { required: true, message: '请选择行业信息', trigger: 'change' }
  188. ],
  189. levelName: [
  190. { required: true, message: '请选择客户等级', trigger: 'change' }
  191. ],
  192. payMode: [
  193. { required: true, message: '请选择付款方式', trigger: 'change' }
  194. ],
  195. clientName: [
  196. { required: true, message: '请填写客户名称', trigger: 'blur' }
  197. ],
  198. contactMan: [
  199. { required: true, message: '请填写联系人', trigger: 'blur' }
  200. ],
  201. contactPhone: [
  202. { required: true, message: '请填写联系电话', trigger: 'blur' }
  203. ],
  204. address: [
  205. { required: true, message: '请填写详细地址', trigger: 'blur' }
  206. ]
  207. },
  208. listData: {
  209. total: 0,
  210. page: 1,
  211. pageSize: 10
  212. },
  213. listData1: {
  214. total: 0,
  215. page: 1,
  216. pageSize: 10
  217. },
  218. confirmdialog: false,
  219. listLoading: false,
  220. tableData: [],
  221. menuId: ''
  222. }
  223. },
  224. mounted() {
  225. this.getTableInfo()
  226. if (this.$route.query.type === undefined) {
  227. this.webType = true
  228. } else {
  229. this.webType = false
  230. }
  231. },
  232. methods: {
  233. handleChange(value) {
  234. this.adrValue = CodeToText[value[0]] + '/' + CodeToText[value[1]] + '/' + CodeToText[value[2]]
  235. // console.log('adrValue', this.adrValue)
  236. },
  237. iscityShow() {
  238. this.cityshow = false
  239. this.selected = []
  240. var t = setTimeout(() => {
  241. this.cityshow = true
  242. }, 0)
  243. },
  244. checkDisable(val) {
  245. // console.log(val);
  246. this.listData.page = 1;
  247. this.getTableInfo()
  248. },
  249. // 获取列表
  250. getTableInfo() {
  251. const _that = this
  252. _that.listLoading = true
  253. if (_that.disableLock) {
  254. _that.search.enable = 0;
  255. } else {
  256. _that.search.enable = 1;
  257. }
  258. var params = _that.search
  259. var page = {
  260. pageIndex: _that.listData.page,
  261. pageSize: _that.listData.pageSize
  262. }
  263. var data = {
  264. 'params': JSON.stringify(params),
  265. 'page': JSON.stringify(page)
  266. }
  267. getInfo(data).then(response => {
  268. const data = response.data
  269. // // 组合表单数据
  270. _that.tableData = data
  271. _that.listData.total = response.total
  272. // console.log(_that.tableData)
  273. _that.listLoading = false
  274. }).catch(err => {
  275. _that.listLoading = false
  276. })
  277. },
  278. // 启用禁用
  279. editStatus(id, status) {
  280. var _that = this
  281. var data = {
  282. id: id,
  283. enable: status
  284. }
  285. var params = {
  286. 'clientInfo': JSON.stringify(data)
  287. }
  288. var url = '/doc/enableClientInfo'
  289. _that.$refs.confirmDialog.updataClick(params, url)
  290. },
  291. // 刷新表格
  292. tableRefresh() {
  293. // 刷新变革
  294. this.getTableInfo()
  295. },
  296. // 搜索
  297. searchData() {
  298. this.listData.page = 1
  299. this.getTableInfo()
  300. },
  301. carEditOrderAddr(id, name) {
  302. this.$refs.address.outerVisible = true;
  303. this.$refs.address.idClient = id;
  304. this.$refs.address.clientName = name;
  305. var pageNum = 1;
  306. this.$refs.address.getInfo(pageNum, '');
  307. this.$refs.address.searchVal = '';
  308. },
  309. getAdress(adr) {
  310. // console.log(adr);
  311. // this.defaultAddress = adr;
  312. // // console.log(this.defaultAddress);
  313. // this.$forceUpdate();//重绘
  314. },
  315. indexMethod(index) {
  316. return index + 1;
  317. },
  318. // 弹窗内选择操作
  319. chooseThis(row) {
  320. // console.log('点击选择');
  321. this.$emit('chooseClient', row)
  322. },
  323. // 查询统计选择
  324. chooseThisTo(row) {
  325. var data = {
  326. id: row.id,
  327. name: row.clientName
  328. }
  329. this.$emit('chooseRow', data)
  330. },
  331. ERPChoose(row) {
  332. // this.$message.error(row)
  333. row.addressList = []
  334. dyERP.sendJson(JSON.stringify(row))
  335. }
  336. }
  337. }
  338. </script>
  339. <style>
  340. .area-select .area-selected-trigger {
  341. padding: 0px 20px 7px 12px !important;
  342. }
  343. .area-select {
  344. height: 40px !important;
  345. }
  346. </style>
  347. <style lang="scss" scoped>
  348. .area-select {
  349. height: 40px;
  350. }
  351. .filter-container {
  352. margin-bottom: 15px;
  353. }
  354. </style>