Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

attachmentMangement.vue 8.6KB

4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
2 месяцев назад
4 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div>
  3. <el-dialog title="产品上线流程附件管理" v-model="isShow" width="50%">
  4. <crud-template
  5. ref="crudRef"
  6. class="as-weight"
  7. :home-data="field"
  8. :table-data="tableData"
  9. @btnSearch="btnSearch"
  10. @add="add"
  11. @handleEdit="handleEdit"
  12. @cancel="cancel"
  13. @submit="submit"
  14. @refreshLeft="refreshLeft"
  15. @CurrentChange="handleCurrentChange"
  16. @handleDelete="handleDelete"
  17. @pageSizeChange="
  18. (val) => {
  19. field.paging.currentPage = 1
  20. field.paging.pageSize = val
  21. // getList()
  22. }
  23. "
  24. >
  25. <template #operation="{ scope }">
  26. <el-button
  27. type="primary"
  28. size="small"
  29. @click.stop="handleDownload(scope.row)"
  30. >
  31. 下载
  32. </el-button>
  33. </template>
  34. <template #status="item">
  35. <el-switch
  36. :model-value="item.scope.row.status"
  37. active-value="ENABLE"
  38. inactive-value="DISABLE"
  39. active-color="#ff4949"
  40. inactive-color="#13ce66"
  41. @click="handleBeforeChange(item.scope.row)"
  42. ></el-switch>
  43. </template>
  44. </crud-template>
  45. </el-dialog>
  46. </div>
  47. </template>
  48. <!-- 协议管理 -->
  49. <script lang="ts" setup>
  50. // @ts-ignore crudFrom模板
  51. import CrudTemplate from '@/crud/index.vue'
  52. import { ref, onMounted, computed, reactive, toRaw, watch } from 'vue'
  53. import { ElMessage } from 'element-plus'
  54. import BaseService from '@/utils/baseService'
  55. import moment from 'moment'
  56. import $storeinitData from '@/store/initData' //引入tab vuex
  57. import { exportFn, importFn } from '@/views/settlement/exportFn'
  58. import { IsPermission } from '@/router/routerUtil'
  59. import { useRoute } from 'vue-router'
  60. import { msgConfirm, typeTy } from '@/utils/msg'
  61. import { Console } from 'console'
  62. const route = useRoute()
  63. const emit = defineEmits(['update:modelValue', 'handleExamine'])
  64. const props = defineProps({
  65. modelValue: {
  66. type: Boolean,
  67. default: false,
  68. },
  69. rowData: {
  70. type: Object,
  71. default: {}
  72. },
  73. IS_ENABLE: {
  74. type: Array,
  75. default: () => [],
  76. },
  77. })
  78. const isShow = computed({
  79. get: function () {
  80. if (props.modelValue) {
  81. getList()
  82. }
  83. return props.modelValue
  84. },
  85. set: function (newValue) {
  86. emit('update:modelValue', newValue)
  87. },
  88. })
  89. const productRowData = ref(props.rowData)
  90. watch(
  91. () => props.rowData,
  92. (newData) => {
  93. productRowData.value = newData
  94. },
  95. {
  96. deep: true,
  97. }
  98. )
  99. // 协议管理******************************
  100. const crudRef = ref()
  101. const searchForm = ref({
  102. groupName: '',
  103. })
  104. const value1 = ref() // 筛选时间
  105. const tableData = ref([])
  106. //表单数据配置
  107. const formLabelWidth = '180px'
  108. const field = ref({
  109. tabSize: 'small', //Table 的尺寸 large / default /small (默认default)
  110. searchShow: false, //是否显示搜索模块(默认false)
  111. border: true, //是否添加边框(默认false)
  112. dialogCustom: false, //自定义Dialog (默认false)
  113. dialogFooter: false, //隐藏弹窗页脚显示 (默认false)
  114. dialogWidth: '40%', //dialog宽度 (默认40%)
  115. crudShow: true, //是否显示CURD操作栏 (默认true)
  116. crudChildShow: true, //是否显示CURD子操作栏 (默认true)
  117. paginStart: true, //是否显示分页查询 (默认false)
  118. isPageSizes: true,//是否修改分页pageSize
  119. pageLayout: 'total, sizes, prev, pager, next',
  120. titleDialog: '', //table 标题
  121. paging: {
  122. pageSize: 10,
  123. currentPage: 1,
  124. total: 0,
  125. },
  126. crud: {
  127. add: true,
  128. },
  129. searchOperation: {
  130. isDownload: false, // 导出
  131. isToLead: false, // 导入
  132. isAdd: false,
  133. isTransferMachine: false,
  134. },
  135. tableSize: -1,
  136. operateShow: true, //是否为表格添加操作栏(默认true)
  137. operateTitle: '操作', //操作栏标题(默认为"")
  138. operateFixed: false, //操作栏是否固定(默认false)
  139. operateWidth: '200', //操作栏宽度
  140. operate: {
  141. info: false, //详情
  142. edit: true, //是否编辑(默认true)
  143. delete: true, //是否删除(默认true)
  144. remark: false, // 查看
  145. },
  146. extend: [
  147. {
  148. type: 'index',
  149. label: '序号',
  150. },
  151. ],
  152. field: [
  153. {
  154. label: '附件名称',
  155. prop: 'fileName',
  156. form: {
  157. formLabelWidth: formLabelWidth,
  158. width: '90%',
  159. type: 'input',
  160. required: true,
  161. },
  162. },
  163. // {
  164. // label: '附件上传',
  165. // prop: 'fileUrl',
  166. // hide: true,
  167. // form: {
  168. // width: '90%',
  169. // formLabelWidth: formLabelWidth,
  170. // type: 'upload',
  171. // placeholder: '请上传附件',
  172. // required: true,
  173. // },
  174. // },
  175. {
  176. prop: 'status',
  177. label: '启用状态',
  178. slotSet: true,
  179. slotSetName: 'status',
  180. listData: props.IS_ENABLE,
  181. },
  182. {
  183. label: '补充文件类型',
  184. prop: 'typeName',
  185. form: {
  186. formLabelWidth: formLabelWidth,
  187. width: '90%',
  188. type: 'input',
  189. required: true,
  190. },
  191. },
  192. {
  193. label: '版本号',
  194. prop: 'version',
  195. form: {
  196. formLabelWidth: formLabelWidth,
  197. width: '90%',
  198. type: 'input',
  199. required: true,
  200. },
  201. },
  202. ],
  203. })
  204. const typeOption = ref('')
  205. const consultativeRowData = ref()
  206. // 编辑按钮
  207. function handleEdit(idx: any, row: any) {
  208. typeOption.value = 'edit'
  209. consultativeRowData.value = row
  210. }
  211. // 新增按钮
  212. function add() {
  213. typeOption.value = 'add'
  214. }
  215. // 提交
  216. function submit(data: any) {
  217. let api = ''
  218. let datas = JSON.parse(JSON.stringify(toRaw(data)))
  219. if (typeOption.value === 'edit') {
  220. // 编辑
  221. api = '/managew/api/product/Attachment/update'
  222. datas.id = consultativeRowData.value.id
  223. } else {
  224. // 新增
  225. api = '/managew/api/product/Attachment/add'
  226. }
  227. datas.releaseId = productRowData.value.releaseId
  228. console.log(datas, 'datasdatas')
  229. BaseService.postN(api, datas).then((res: any) => {
  230. if (res && res.code === 0) {
  231. ElMessage.success('操作成功')
  232. console.log("提交调用")
  233. getList()
  234. cancel()
  235. } else {
  236. ElMessage.error(res.message)
  237. }
  238. })
  239. }
  240. // 删除按钮
  241. function handleDelete(idx: any, row: any) {
  242. const data = {
  243. id: row.id,
  244. }
  245. BaseService.postN('/managew/api/product/relaseAttachFiles/delete', {
  246. id: data.id,
  247. }).then((res: any) => {
  248. if (res && res.statusCode === 0) {
  249. ElMessage.success('操作成功')
  250. console.log("删除调用")
  251. getList()
  252. cancel()
  253. } else {
  254. ElMessage.error(res.message)
  255. }
  256. })
  257. }
  258. // 取消
  259. function cancel() {
  260. crudRef.value.reset()
  261. crudRef.value.dialogFormVisible = false
  262. }
  263. // 搜索按钮
  264. function btnSearch() {
  265. field.value.paging.currentPage = 1
  266. console.log("搜索调用")
  267. getList()
  268. }
  269. // 搜索重置
  270. function refreshLeft() {
  271. field.value.paging.currentPage = 1
  272. searchForm.value = {
  273. groupName: '',
  274. }
  275. value1.value = null
  276. tableData.value = []
  277. console.log("重置调用")
  278. getList()
  279. }
  280. // 获取列表
  281. function getList(refresh?) {
  282. if (crudRef.value) crudRef.value.tableLoding = true
  283. // 参数
  284. let params: any = {
  285. releaseId: productRowData.value.releaseId,
  286. pageNo: field.value.paging.currentPage,
  287. pageSize: field.value.paging.pageSize,
  288. }
  289. // const searchFormList = { ...searchForm.value }
  290. // for (const key in searchFormList) {
  291. // if (searchFormList[key]) {
  292. // params[key] = searchFormList[key]
  293. // }
  294. // }
  295. BaseService.postN(
  296. '/managew/api/product/Attachment/page',
  297. params
  298. ).then((res: any) => {
  299. if (res && res.code === 0) {
  300. tableData.value = res.data.result || []
  301. //分页总数
  302. field.value.paging.total = res.data.totalCount
  303. crudRef.value.tableLoding = false
  304. } else {
  305. crudRef.value.tableLoding = false
  306. ElMessage.error(res.message)
  307. }
  308. })
  309. }
  310. function handleCurrentChange(val: number) {
  311. field.value.paging.currentPage = val
  312. console.log("换页调用")
  313. getList()
  314. }
  315. //切换按钮 1 启用 0 停用
  316. function handleBeforeChange(row) {
  317. let text = row.status == 'ENABLE' ? '停用' : '启用'
  318. msgConfirm(`请确认是否 ${text} ${row.fileName}`, typeTy.warning).then(() => {
  319. // do something
  320. const params = {
  321. id: row.id,
  322. status: row.status == 'ENABLE' ? 'DISABLE' : 'ENABLE',
  323. }
  324. console.log(params, 'paramsparams')
  325. BaseService.postN(
  326. '/managew/api/product/Attachment/status',
  327. params
  328. ).then((res: any) => {
  329. if (res && res.code === 0) {
  330. ElMessage.success(`${text}成功`)
  331. getList(true)
  332. } else {
  333. ElMessage.error(res.message)
  334. }
  335. })
  336. })
  337. }
  338. const handleDownload = (data) => {
  339. BaseService.getDownload(
  340. import.meta.env.VITE_APP_UPLOAD_URL + data.fileUrl,
  341. data.fileName,
  342. true
  343. )
  344. }
  345. </script>