crossDistrictkList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :export-list="exportList"
  6. :operation="operation()"
  7. :pofx="true"
  8. :column-parsing="columnParsing"
  9. :operation-column-width="160"
  10. :options-evens-group="optionsEvensGroup"
  11. :table-attributes="tableAttributes"
  12. :table-events="tableEvents"
  13. :replaceOrNotMap ="false"
  14. :ellipsis="false"
  15. >
  16. <Popu v-if="visible">
  17. <el-page-header slot="head" :content="content" @back="handleClose" />
  18. <CrossDistrictForm
  19. v-if="['add', 'edit','apply'].includes(module)"
  20. :detail-id="detailId"
  21. :module="module"
  22. @updateList="handleClose"
  23. />
  24. <Detail v-if="['detail'].includes(module)" :detail-id="detailId" :module="module" @updateList="handleClose" />
  25. <Examine v-if="['examine'].includes(module)" :detail-id="detailId" :module="module" @updateList="handleClose" />
  26. </Popu>
  27. <Operate v-if="operateVisible" :operate-visible="operateVisible" :operate-type="operateType" :operate-title="operateTitle" :detail-id="detailId" :record-selected="recordSelected" @close="handleClose" />
  28. </template-page>
  29. </template>
  30. <script>
  31. import TemplatePage from '@/components/template/template-page-1.vue'
  32. import import_mixin from '@/components/template/import_mixin.js'
  33. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  34. import Popu from '@/components/template/popu.vue'
  35. import CrossDistrictForm from './crossDistrictForm.vue'
  36. import Detail from './detail.vue'
  37. import Examine from './examine.vue'
  38. import Operate from '../components/operate.vue'
  39. import { mapGetters } from 'vuex'
  40. import { getLoginCrossDistrictList, exportLoginCrossDistrict } from '@/api/crossDistrict'
  41. export default {
  42. components: { TemplatePage, Popu, CrossDistrictForm, Detail, Examine, Operate },
  43. mixins: [import_mixin, add_callback_mixin],
  44. data() {
  45. return {
  46. visible: false,
  47. // 事件组合
  48. // 表格属性
  49. tableAttributes: {
  50. // 启用勾选列
  51. selectColumn: true
  52. }, // 关闭新增弹窗
  53. // 表格事件
  54. tableEvents: {
  55. 'selection-change': this.selectionChange
  56. },
  57. recordSelected: [],
  58. content: '新增',
  59. detailId: '',
  60. module: 'add', // ['add', 'edit', 'detail', 'examine']
  61. operateVisible: false,
  62. operateType: null,
  63. operateTitle: null
  64. }
  65. },
  66. computed: {
  67. ...mapGetters(['isTradeExaminer']),
  68. optionsEvensGroup() {
  69. return [
  70. [
  71. [
  72. {
  73. name: '添加记录',
  74. click: this.addOn(() => {
  75. this.visible = true
  76. })
  77. }
  78. ]
  79. ],
  80. ...(() => {
  81. return this.isTradeExaminer
  82. ? [
  83. [
  84. [
  85. {
  86. name: '更新',
  87. click: () => {
  88. if (this.recordSelected.length === 0) {
  89. this.$message.error('请选择需要更新的数据')
  90. return
  91. }
  92. for (let index = 0; index < this.recordSelected.length; index++) {
  93. if (!(this.recordSelected[index].orderStatus == '已审核' && this.recordSelected[index].status == '跟进中')) {
  94. this.$message.error('请选择审核通过并且跟进中的数据')
  95. return
  96. }
  97. }
  98. this.operateType = 'update'
  99. this.operateTitle = '更新'
  100. this.operateVisible = true
  101. }
  102. }
  103. ]
  104. ],
  105. [
  106. [
  107. {
  108. name: '替换业务员',
  109. click: () => {
  110. if (this.recordSelected.length === 0) {
  111. this.$message.error('请选择需要替换业务员的数据')
  112. return
  113. }
  114. for (let index = 0; index < this.recordSelected.length; index++) {
  115. if (this.recordSelected[index].orderStatus !== '已审核') {
  116. this.$message.error('请选择审核通过的数据')
  117. return
  118. }
  119. }
  120. this.operateType = 'replace'
  121. this.operateTitle = '替换业务员'
  122. this.operateVisible = true
  123. }
  124. }
  125. ]
  126. ]
  127. ]
  128. : []
  129. })(),
  130. [
  131. [
  132. {
  133. name: '删除',
  134. click: () => {
  135. if (this.recordSelected.length === 0) {
  136. this.$message.error('请选择需要删除的数据')
  137. return
  138. }
  139. if(!this.isTradeExaminer){
  140. for (let index = 0; index < this.recordSelected.length; index++) {
  141. if (this.recordSelected[index].orderStatus !== '保存') {
  142. this.$message.error('请选择保存的数据')
  143. return
  144. }
  145. }
  146. }
  147. // for (let index = 0; index < this.recordSelected.length; index++) {
  148. // if (this.recordSelected[index].orderStatus !== '已审核') {
  149. // this.$message.error('请选择审核通过的数据')
  150. // return
  151. // }
  152. // }
  153. this.operateType = 'delete'
  154. this.operateTitle = '删除'
  155. this.operateVisible = true
  156. }
  157. }
  158. ]
  159. ]
  160. ]
  161. }
  162. },
  163. created() {
  164. this.getCurrentRoute()
  165. },
  166. methods: {
  167. // 列表请求函数
  168. getList(...p) {
  169. this.recordSelected = []
  170. return getLoginCrossDistrictList(...p)
  171. },
  172. // 列表导出函数
  173. exportList: exportLoginCrossDistrict,
  174. // 表格列解析渲染数据更改
  175. columnParsing(item, defaultData) {
  176. if (item.colName === 'project_no') {
  177. defaultData.render = (h, { row, index, column }) => {
  178. return (<el-link type='primary' underline={false} onClick={() => {
  179. const page = this.$router.resolve({
  180. path: '/commercialEngineering/crossDistrictkList',
  181. query: {
  182. detailId: row.id,
  183. module: 'detail'
  184. }
  185. })
  186. window.open(page.href, '_blank')
  187. }}>{row.projectNo}</el-link>)
  188. }
  189. }
  190. return defaultData
  191. },
  192. // 监听勾选变化
  193. selectionChange(data) {
  194. this.recordSelected = data
  195. },
  196. operation() {
  197. return (h, { row, index, column }) => {
  198. return (
  199. <div class='operation-btns'>
  200. {!this.isTradeExaminer && ((row.orderStatus === 'OK') && row.status === 'ING' && !row.isApplyUpdate) ? (
  201. <el-button
  202. size='mini'
  203. type='text'
  204. onClick={() => {
  205. this.detailId = row.id
  206. this.operateType = 'apply'
  207. this.operateTitle = '申请修改'
  208. this.operateVisible = true
  209. }}
  210. >
  211. 申请修改
  212. </el-button>
  213. ) : null}
  214. {this.isTradeExaminer && row.orderStatus !== 'SAVE' ? (
  215. <el-button
  216. size='mini'
  217. type='text'
  218. onClick={() => {
  219. this.content = '审核'
  220. this.module = 'examine'
  221. this.detailId = row.id
  222. this.visible = true
  223. }}
  224. >
  225. 审核
  226. </el-button>
  227. ) : null}
  228. {/* <el-button
  229. size='mini'
  230. type='text'
  231. onClick={() => {
  232. this.content = '详情'
  233. this.module = 'detail'
  234. this.detailId = row.id
  235. this.visible = true
  236. }}
  237. >
  238. 详情
  239. </el-button> */}
  240. {(this.isTradeExaminer &&
  241. (row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN' || row.status === 'ING')) ||
  242. row.orderStatus === 'SAVE' ||
  243. row.orderStatus === 'RETURN'
  244. ? <el-button
  245. size='mini'
  246. type='text'
  247. onClick={() => {
  248. this.content = '编辑'
  249. this.module = 'edit'
  250. this.detailId = row.id
  251. this.visible = true
  252. }}
  253. >
  254. 编辑
  255. </el-button> : null
  256. }
  257. {row.orderStatus === 'OK' && row.status === 'ING'
  258. ? <el-button size='mini' type='text' onClick={() => {
  259. this.operateType = 'update'
  260. this.operateTitle = '更新'
  261. this.recordSelected = [row]
  262. this.operateVisible = true
  263. }}>
  264. 更新
  265. </el-button> : null
  266. }
  267. {this.isTradeExaminer && ((row.orderStatus === 'OK' || row.orderStatus === 'FAIL') && row.isApplyUpdate) ? (
  268. <el-button
  269. size='mini'
  270. type='text'
  271. onClick={() => {
  272. this.detailId = row.id
  273. this.operateType = 'examine'
  274. this.operateTitle = '审核修改'
  275. this.operateVisible = true
  276. }}
  277. >
  278. 审核修改
  279. </el-button>
  280. ) : null}
  281. </div>
  282. )
  283. }
  284. },
  285. handleClose() {
  286. this.getCurrentRoute('OK')
  287. this.addOff(() => {
  288. this.content = '新增'
  289. this.module = 'add'
  290. this.operateVisible = false
  291. this.operateTitle = null
  292. this.operateType = null
  293. this.detailId = ''
  294. this.visible = false
  295. this.$refs.pageRef.refreshList()
  296. })()
  297. },
  298. getCurrentRoute(back) {
  299. const { detailId, module } = this.$route.query
  300. if (back === 'OK' && module === 'detail') {
  301. this.$router.replace('/commercialEngineering/frockList')
  302. return
  303. }
  304. if (detailId && module === 'detail') {
  305. this.content = '详情'
  306. this.detailId = detailId
  307. this.module = module
  308. this.visible = true
  309. }
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="scss" scoped></style>