index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
  3. <template slot-scope="{activeKey, data}">
  4. <div :style="{
  5. width: '100%',
  6. height: activeKey == 'list' ? '100%' : '0px',
  7. overflow: 'hidden'
  8. }">
  9. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
  10. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  11. :exportList="exportList" :operation="operation()">
  12. </template-page>
  13. </div>
  14. <div v-if="~['add', 'detail'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
  15. <div>
  16. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  17. <zj-form-module title="客户信息" :showPackUp="false" :form-data="formData" :form-items="basicInfo">
  18. </zj-form-module>
  19. <zj-form-module title="产品信息" :showPackUp="false" :form-data="formData" :form-items="product">
  20. </zj-form-module>
  21. <zj-form-module title="处罚信息" label-width="100px" :showPackUp="false" :form-data="formData"
  22. :form-items="pandanxinxi">
  23. </zj-form-module>
  24. <zj-form-module title="处置信息" label-width="100px" :showPackUp="false" :form-data="formData"
  25. :form-items="czpandanxinxi">
  26. </zj-form-module>
  27. </zj-form-container>
  28. <div slot="footer" class="dialog-footer">
  29. <el-button size="mini" @click="data.removeTab">取 消</el-button>
  30. <el-button v-if="!formData.status || formData.status == 'SAVE'" size="mini" type="primary"
  31. @click="quedingbaocun(data.removeTab)">保存</el-button>
  32. <el-button v-if="formData.status == 'SAVE'" size="mini" type="primary"
  33. @click="quedingshenhe(data.removeTab)">审核</el-button>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. </zj-tab-page>
  39. </template>
  40. <script>
  41. import TemplatePage from '@/components/template/template-page-1.vue'
  42. import import_mixin from '@/components/template/import_mixin.js'
  43. import operation_mixin from '@/components/template/operation_mixin.js'
  44. import basicInfo from "./mixins/basicInfo"
  45. import productColumns from "./mixins/productColumns"
  46. import pandanxinxi from "./mixins/pandanxinxi"
  47. import czpandanxinxi from "./mixins/czpandanxinxi"
  48. import { orderPunishList, orderPunishListExport, orderPunishExamine, orderPunishDelete, orderPunishDetail, orderPunishSave } from "@/api/penaltyWorkOrder";
  49. export default {
  50. components: { TemplatePage },
  51. mixins: [import_mixin, operation_mixin, basicInfo, productColumns, pandanxinxi, czpandanxinxi],
  52. data() {
  53. return {
  54. // 表格属性
  55. tableAttributes: {
  56. // 启用勾选列
  57. selectColumn: false
  58. },
  59. // 表格事件
  60. tableEvents: {
  61. 'selection-change': this.selectionChange
  62. },
  63. // 勾选选中行
  64. recordSelected: [],
  65. formData: {
  66. "address": "",
  67. "area": "",
  68. "areaId": "",
  69. "city": "",
  70. "cityId": "",
  71. "disposeOrderBaseId": "",
  72. "disposeOrderSmallType": "",
  73. "disposeOrderSmallTypeText": "",
  74. "disposeWebsitId": "",
  75. "disposeWebsitName": "",
  76. "disposeWorkerId": "",
  77. "disposeWorkerMobile": "",
  78. "disposeWorkerName": "",
  79. "examineBy": "",
  80. "examineRemark": "",
  81. "examineTime": "",
  82. "fileUrls": [],
  83. "id": "",
  84. "linkName": "",
  85. "orderBaseId": "",
  86. "orderSmallType": "",
  87. "orderSmallTypeText": "",
  88. "province": "",
  89. "provinceId": "",
  90. "punishOrderProducts": [
  91. {
  92. "brandId": "",
  93. "brandName": "",
  94. "insideCode": "",
  95. "mainId": "",
  96. "mainName": "",
  97. "outCode": "",
  98. "punishOrderId": "",
  99. "smallId": "",
  100. "smallName": "",
  101. "specsName": "",
  102. }
  103. ],
  104. "punishOrderWorkers": [],
  105. "remark": "",
  106. "status": "",
  107. "street": "",
  108. "streetId": "",
  109. "totalAmount": "",
  110. "userMobile": "",
  111. "userMobile2": "",
  112. "userName": "",
  113. "websitId": "",
  114. "websitName": "",
  115. },
  116. }
  117. },
  118. computed: {
  119. // 更多参数
  120. moreParameters() {
  121. return []
  122. },
  123. // 事件组合
  124. optionsEvensGroup() {
  125. return [
  126. [
  127. [
  128. this.optionsEvensAuth('add', {
  129. click: () => {
  130. this.$refs.tabPage.addTab({
  131. // 对应显示的模块
  132. activeKey: "add",
  133. // 唯一标识
  134. key: "add",
  135. // 页签名称
  136. label: "新增",
  137. // 打开时事件
  138. triggerEvent: () => {
  139. this.handleClose()
  140. this.$nextTick(() => {
  141. this.openForm()
  142. })
  143. },
  144. // 关闭时事件
  145. closeEvent: () => { }
  146. })
  147. }
  148. })
  149. ]
  150. ]
  151. ]
  152. },
  153. },
  154. methods: {
  155. // 列表请求函数
  156. getList: orderPunishList,
  157. // 列表导出函数
  158. exportList: orderPunishListExport,
  159. // 表格列解析渲染数据更改
  160. columnParsing(item, defaultData) {
  161. return defaultData
  162. },
  163. // 监听勾选变化
  164. selectionChange(data) {
  165. this.recordSelected = data
  166. },
  167. // 关闭
  168. handleClose() {
  169. this.$data.formData = this.$options.data().formData
  170. },
  171. // 打开弹窗
  172. openForm() {
  173. this.getinitlbslist()
  174. this.getProductSel()
  175. this.getWebsitList()
  176. this.getWorkers()
  177. this.getorderSmallTypeData()
  178. this.getdisposeWebsitIds()
  179. },
  180. // 保存
  181. quedingbaocun(removeTab) {
  182. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  183. if (valid) {
  184. orderPunishSave({
  185. ...this.formData,
  186. fileUrls: this.formData.fileUrls.map(item => item.url).join(",")
  187. }).then(res => {
  188. this.$message({
  189. type: 'success',
  190. message: '保存成功'
  191. })
  192. this.$refs.pageRef.refreshList()
  193. removeTab && removeTab()
  194. this.handleClose()
  195. })
  196. }
  197. })
  198. },
  199. // 审核
  200. quedingshenhe(removeTab) {
  201. orderPunishExamine({
  202. id: this.formData.id,
  203. status: "OK",
  204. }).then(res => {
  205. this.$message({
  206. type: 'success',
  207. message: '审核成功'
  208. })
  209. this.$refs.pageRef.refreshList()
  210. removeTab && removeTab()
  211. this.handleClose()
  212. })
  213. },
  214. // 操作按钮
  215. operation() {
  216. return this.operationBtn({
  217. detail: {
  218. click: ({ row, index, column }) => {
  219. this.$refs.tabPage.addTab({
  220. // 对应显示的模块
  221. activeKey: "detail",
  222. // 唯一标识
  223. key: "detail",
  224. // 页签名称
  225. label: "详情",
  226. // 打开时事件
  227. triggerEvent: () => {
  228. this.handleClose()
  229. this.$nextTick(() => {
  230. orderPunishDetail({ id: row.id }).then(res => {
  231. Object.assign(this.formData, res.data, {
  232. fileUrls: res.data.fileUrls ? res.data.fileUrls.split(",").map(url => ({ url })) : []
  233. })
  234. this.openForm()
  235. })
  236. })
  237. },
  238. // 关闭时事件
  239. closeEvent: () => { }
  240. })
  241. }
  242. },
  243. del: {
  244. prompt: "是否确定删除?",
  245. conditions: ({ row, index, column }) => {
  246. return row.status != "OK"
  247. },
  248. click: ({ row, index, column }) => {
  249. orderPunishDelete({ id: row.id }).then(res => {
  250. this.$message({
  251. type: 'success',
  252. message: '删除成功'
  253. })
  254. this.$refs.pageRef.refreshList()
  255. })
  256. }
  257. }
  258. })
  259. },
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped></style>