crossDistrictkList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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 == 'OK' && this.recordSelected[index].status == 'ING')) {
  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 !== 'OK') {
  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 !== 'SAVE') {
  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 ( <div style="padding:0 6px;cursor: pointer;" class={{ 'text-view': true, 'text-view-copy': column.isCopy }}>
  179. <el-link
  180. type="primary"
  181. underline={false}
  182. onClick={() => {
  183. const page = this.$router.resolve({
  184. path: '/commercialEngineering/frockList',
  185. query: {
  186. detailId: row.id,
  187. module: 'detail'
  188. }
  189. })
  190. window.open(page.href, '_blank')
  191. }}
  192. >
  193. {row.projectNo}
  194. </el-link>
  195. {column.isCopy ? (
  196. <i
  197. class={['el-icon-document-copy', column.columnCopyClass]}
  198. data-clipboard-text={row[column.columnAttributes.prop]}
  199. ></i>
  200. ) : null}
  201. </div>)
  202. }
  203. }
  204. return defaultData
  205. },
  206. // 监听勾选变化
  207. selectionChange(data) {
  208. this.recordSelected = data
  209. },
  210. operation() {
  211. return (h, { row, index, column }) => {
  212. return (
  213. <div class='operation-btns'>
  214. {!this.isTradeExaminer && ((row.orderStatus === 'OK') && row.status === 'ING' && !row.isApplyUpdate) ? (
  215. <el-button
  216. size='mini'
  217. type='text'
  218. onClick={() => {
  219. this.detailId = row.id
  220. this.operateType = 'apply'
  221. this.operateTitle = '申请修改'
  222. this.operateVisible = true
  223. }}
  224. >
  225. 申请修改
  226. </el-button>
  227. ) : null}
  228. {this.isTradeExaminer && row.orderStatus !== 'SAVE' ? (
  229. <el-button
  230. size='mini'
  231. type='text'
  232. onClick={() => {
  233. this.content = '审核'
  234. this.module = 'examine'
  235. this.detailId = row.id
  236. this.visible = true
  237. }}
  238. >
  239. 审核
  240. </el-button>
  241. ) : null}
  242. {/* <el-button
  243. size='mini'
  244. type='text'
  245. onClick={() => {
  246. this.content = '详情'
  247. this.module = 'detail'
  248. this.detailId = row.id
  249. this.visible = true
  250. }}
  251. >
  252. 详情
  253. </el-button> */}
  254. {(this.isTradeExaminer &&
  255. (row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN' || row.status === 'ING')) ||
  256. row.orderStatus === 'SAVE' ||
  257. row.orderStatus === 'RETURN'
  258. ? <el-button
  259. size='mini'
  260. type='text'
  261. onClick={() => {
  262. this.content = '编辑'
  263. this.module = 'edit'
  264. this.detailId = row.id
  265. this.visible = true
  266. }}
  267. >
  268. 编辑
  269. </el-button> : null
  270. }
  271. {row.orderStatus === 'OK' && row.status === 'ING'
  272. ? <el-button size='mini' type='text' onClick={() => {
  273. this.operateType = 'update'
  274. this.operateTitle = '更新'
  275. this.recordSelected = [row]
  276. this.operateVisible = true
  277. }}>
  278. 更新
  279. </el-button> : null
  280. }
  281. {this.isTradeExaminer && ((row.orderStatus === 'OK' || row.orderStatus === 'FAIL') && row.isApplyUpdate) ? (
  282. <el-button
  283. size='mini'
  284. type='text'
  285. onClick={() => {
  286. this.detailId = row.id
  287. this.operateType = 'examine'
  288. this.operateTitle = '审核修改'
  289. this.operateVisible = true
  290. }}
  291. >
  292. 审核修改
  293. </el-button>
  294. ) : null}
  295. </div>
  296. )
  297. }
  298. },
  299. handleClose() {
  300. this.getCurrentRoute('OK')
  301. this.addOff(() => {
  302. this.content = '新增'
  303. this.module = 'add'
  304. this.operateVisible = false
  305. this.operateTitle = null
  306. this.operateType = null
  307. this.detailId = ''
  308. this.visible = false
  309. this.$refs.pageRef.refreshList()
  310. })()
  311. },
  312. getCurrentRoute(back) {
  313. const { detailId, module } = this.$route.query
  314. if (back === 'OK' && module === 'detail') {
  315. this.$router.replace('/commercialEngineering/frockList')
  316. return
  317. }
  318. if (detailId && module === 'detail') {
  319. this.content = '详情'
  320. this.detailId = detailId
  321. this.module = module
  322. this.visible = true
  323. }
  324. }
  325. }
  326. }
  327. </script>
  328. <style lang="scss" scoped></style>