index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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">
  17. <zj-form-module title="单据信息" :form-data="formData" :form-items="formItems">
  18. </zj-form-module>
  19. <zj-form-module title="客户信息" :form-data="formData" :form-items="basicInfo">
  20. </zj-form-module>
  21. <zj-form-module title="产品信息" :form-data="formData" :form-items="product">
  22. </zj-form-module>
  23. <zj-form-module title="负激励信息" label-width="120px" :form-data="formData" :form-items="pandanxinxi">
  24. </zj-form-module>
  25. <zj-form-module title="正激励信息" label-width="120px" :form-data="formData" :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 common_form from "./mixins/common_form"
  49. import { orderPunishList, orderPunishListExport, orderPunishExamine, orderPunishDelete, orderPunishDetail, orderPunishSave } from "@/api/penaltyWorkOrder";
  50. export default {
  51. components: { TemplatePage },
  52. mixins: [import_mixin, operation_mixin, basicInfo, productColumns, pandanxinxi, czpandanxinxi, common_form],
  53. data() {
  54. return {
  55. // 表格属性
  56. tableAttributes: {
  57. // 启用勾选列
  58. selectColumn: false
  59. },
  60. // 表格事件
  61. tableEvents: {
  62. 'selection-change': this.selectionChange
  63. },
  64. // 勾选选中行
  65. recordSelected: [],
  66. formData: {
  67. "address": "",
  68. "area": "",
  69. "areaId": "",
  70. "city": "",
  71. "cityId": "",
  72. "disposeOrderBaseId": "",
  73. "disposeOrderSmallType": "",
  74. "disposeOrderSmallTypeText": "",
  75. "disposeWebsitId": "",
  76. "disposeWebsitName": "",
  77. "disposeWorkerId": "",
  78. "disposeWorkerMobile": "",
  79. "disposeWorkerName": "",
  80. "examineBy": "",
  81. "examineRemark": "",
  82. "examineTime": "",
  83. "fileUrls": [],
  84. "id": "",
  85. "linkName": "",
  86. "orderBaseId": "",
  87. "orderSmallType": "",
  88. "orderSmallTypeText": "",
  89. "province": "",
  90. "provinceId": "",
  91. "punishOrderProducts": [
  92. {
  93. "brandId": "",
  94. "brandName": "",
  95. "insideCode": "",
  96. "mainId": "",
  97. "mainName": "",
  98. "outCode": "",
  99. "punishOrderId": "",
  100. "smallId": "",
  101. "smallName": "",
  102. "specsName": "",
  103. }
  104. ],
  105. "punishOrderWorkers": [],
  106. "remark": "",
  107. // "status": "",
  108. "street": "",
  109. "streetId": "",
  110. "totalAmount": "",
  111. "userMobile": "",
  112. "userMobile2": "",
  113. "userName": "",
  114. "websitId": "",
  115. "websitName": "",
  116. },
  117. }
  118. },
  119. computed: {
  120. // 更多参数
  121. moreParameters() {
  122. return []
  123. },
  124. // 事件组合
  125. optionsEvensGroup() {
  126. return [
  127. [
  128. [
  129. this.optionsEvensAuth('add', {
  130. click: () => {
  131. this.$refs.tabPage.addTab({
  132. // 对应显示的模块
  133. activeKey: "add",
  134. // 唯一标识
  135. key: "add",
  136. // 页签名称
  137. label: "新增",
  138. // 打开时事件
  139. triggerEvent: () => {
  140. this.handleClose()
  141. this.$nextTick(() => {
  142. this.openForm()
  143. })
  144. },
  145. // 关闭时事件
  146. closeEvent: () => { }
  147. })
  148. }
  149. })
  150. ]
  151. ]
  152. ]
  153. },
  154. },
  155. mounted() {
  156. this.initFun()
  157. },
  158. methods: {
  159. initFun() {
  160. if (this.pageType == "detail") {
  161. this.$refs.tabPage.addTab({
  162. // 对应显示的模块
  163. activeKey: "detail",
  164. // 唯一标识
  165. key: "detail",
  166. // 页签名称
  167. label: "详情",
  168. // 打开时事件
  169. triggerEvent: () => {
  170. this.handleClose()
  171. this.$nextTick(() => {
  172. orderPunishDetail({ id: this.pageCode }).then(res => {
  173. Object.assign(this.formData, res.data, {
  174. fileUrls: res.data.fileUrls ? res.data.fileUrls.split(",").map(url => ({ url })) : []
  175. })
  176. this.openForm()
  177. })
  178. })
  179. },
  180. // 关闭时事件
  181. closeEvent: () => { }
  182. })
  183. }
  184. },
  185. // 列表请求函数
  186. getList: orderPunishList,
  187. // 列表导出函数
  188. exportList: orderPunishListExport,
  189. // 表格列解析渲染数据更改
  190. columnParsing(item, defaultData) {
  191. return defaultData
  192. },
  193. // 监听勾选变化
  194. selectionChange(data) {
  195. this.recordSelected = data
  196. },
  197. // 关闭
  198. handleClose() {
  199. this.$data.formData = this.$options.data().formData
  200. },
  201. // 打开弹窗
  202. openForm() {
  203. this.getinitlbslist()
  204. this.getProductSel()
  205. this.getWebsitList()
  206. this.getWorkers()
  207. this.getorderSmallTypeData()
  208. this.getdisposeWebsitIds()
  209. },
  210. // 保存
  211. quedingbaocun(removeTab) {
  212. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  213. if (valid) {
  214. orderPunishSave({
  215. ...this.formData,
  216. fileUrls: this.formData.fileUrls.map(item => item.url).join(",")
  217. }).then(res => {
  218. this.$message({
  219. type: 'success',
  220. message: '保存成功'
  221. })
  222. this.$refs.pageRef.refreshList()
  223. removeTab && removeTab()
  224. this.handleClose()
  225. })
  226. }
  227. })
  228. },
  229. // 审核
  230. quedingshenhe(removeTab) {
  231. orderPunishExamine({
  232. id: this.formData.id,
  233. status: "OK",
  234. }).then(res => {
  235. this.$message({
  236. type: 'success',
  237. message: '审核成功'
  238. })
  239. this.$refs.pageRef.refreshList()
  240. removeTab && removeTab()
  241. this.handleClose()
  242. })
  243. },
  244. // 操作按钮
  245. operation() {
  246. return this.operationBtn({
  247. detail: {
  248. click: ({ row, index, column }) => {
  249. this.$refs.tabPage.addTab({
  250. // 对应显示的模块
  251. activeKey: "detail",
  252. // 唯一标识
  253. key: "detail",
  254. // 页签名称
  255. label: "详情",
  256. // 打开时事件
  257. triggerEvent: () => {
  258. this.handleClose()
  259. this.$nextTick(() => {
  260. orderPunishDetail({ id: row.id }).then(res => {
  261. Object.assign(this.formData, res.data, {
  262. fileUrls: res.data.fileUrls ? res.data.fileUrls.split(",").map(url => ({ url })) : []
  263. })
  264. this.openForm()
  265. })
  266. })
  267. },
  268. // 关闭时事件
  269. closeEvent: () => { }
  270. })
  271. }
  272. },
  273. del: {
  274. prompt: "是否确定删除?",
  275. conditions: ({ row, index, column }) => {
  276. return row.status != "OK"
  277. },
  278. click: ({ row, index, column }) => {
  279. orderPunishDelete({ id: row.id }).then(res => {
  280. this.$message({
  281. type: 'success',
  282. message: '删除成功'
  283. })
  284. this.$refs.pageRef.refreshList()
  285. })
  286. }
  287. }
  288. })
  289. },
  290. }
  291. }
  292. </script>
  293. <style lang="scss" scoped></style>