crossDistrictkList.vue 11 KB

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