index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
  4. :table-loading="loading" @search-change="searchChange" @search-reset="searchReset"
  5. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad">
  7. <template slot="cornIdSearch">
  8. <select-component v-model="search.cornId" :configuration="configuration"></select-component>
  9. </template>
  10. <template slot-scope="scope" slot="cornId">
  11. {{ scope.row.cornName }}
  12. </template>
  13. <template slot="menuLeft">
  14. <el-button icon="el-icon-printer" size="small" type="primary" :loading="exportLoading" @click.stop="downFile">导出
  15. </el-button>
  16. </template>
  17. <template slot="userid" slot-scope="{row,index}">
  18. <user-select style="width:90% !important;" v-if="row.$cellEdit" v-model="row.userName"
  19. @value="(values) => value(values, row)" :configuration="UConfiguration">
  20. </user-select>
  21. <span v-else>{{ row.userName }}</span>
  22. </template>
  23. <template slot-scope="{row,index}" slot="menu">
  24. <el-button type="text" icon="el-icon-view" size="small" @click.stop="copyTo">发送
  25. </el-button>
  26. <el-button type="text" icon="el-icon-edit" :disabled="row.status != 5 || row.taskStatus == 30" size="small"
  27. @click.stop="completion(row)">完工
  28. </el-button>
  29. <el-button type="text" icon="el-icon-edit" size="small" @click.stop="rowCell(row)">{{ row.$cellEdit ? "保存" :
  30. "修改"
  31. }}
  32. </el-button>
  33. </template>
  34. </avue-crud>
  35. <el-dialog append-to-body title="消息" class="el-dialogDeep" :visible.sync="copyToDialog" width="60%"
  36. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  37. <avue-form class="trading-form" :option="optionMeg" ref="formMeg" v-model="formMeg">
  38. <template slot="toUserId">
  39. <el-select v-model="formMeg.toUserId" remote filterable clearable @change="toUserChange"
  40. :remote-method="remoteMethod">
  41. <el-option v-for="item in userOption" :key="item.value" :label="item.realName" :value="item.id">
  42. </el-option>
  43. </el-select>
  44. </template>
  45. </avue-form>
  46. <div style="margin-left: 80%;padding: 10px">
  47. <el-button size="small" @click="copyToDialog = false">取消</el-button>
  48. <el-button type="primary" size="small" @click="submitCopy()">确定</el-button>
  49. </div>
  50. </el-dialog>
  51. </basic-container>
  52. </template>
  53. <script>
  54. import option from "./configuration/mainList.json";
  55. import { getFlowList } from "@/api/workManagement/mainProject";
  56. import { updateItemStatus } from "@/api/workManagement/mainProject";
  57. import { getUserList } from "@/api/workManagement/mainProject";
  58. import { saveMessage } from "@/api/logs";
  59. export default {
  60. name: "customerInformation",
  61. data() {
  62. return {
  63. loading: false,
  64. exportLoading: false,
  65. copyToDialog: false,
  66. form: {},
  67. search: {},
  68. configuration: {
  69. multipleChoices: false,
  70. multiple: false,
  71. disabled: false,
  72. searchShow: true,
  73. collapseTags: false,
  74. clearable: true,
  75. placeholder: '请点击右边按钮选择',
  76. dicData: []
  77. },
  78. option: option,
  79. parentId: 0,
  80. dataList: [],
  81. page: {
  82. currentPage: 1,
  83. total: 0,
  84. pageSize: 10
  85. },
  86. query: {},
  87. userOption: [],
  88. optionMeg: {
  89. emptyBtn: false,
  90. submitBtn: false,
  91. labelWidth: 120,
  92. menuSpan: 8,
  93. column: [
  94. {
  95. label: '抄送人',
  96. prop: 'toUserId',
  97. span: 12,
  98. type: 'select',
  99. rules: [
  100. {
  101. required: true,
  102. message: ' ',
  103. trigger: 'blur'
  104. }
  105. ]
  106. },
  107. {
  108. label: '抄送日期',
  109. prop: 'createTime',
  110. type: "datetime",
  111. span: 12,
  112. disabled: true,
  113. rules: [
  114. {
  115. required: false,
  116. message: ' ',
  117. trigger: 'blur'
  118. }
  119. ]
  120. },
  121. {
  122. label: '内容',
  123. prop: 'messageBody',
  124. span: 24,
  125. rules: [
  126. {
  127. required: true,
  128. message: ' ',
  129. trigger: 'blur'
  130. }
  131. ]
  132. }
  133. ]
  134. },
  135. formMeg: {},
  136. UConfiguration: {
  137. multipleChoices: false,
  138. multiple: false,
  139. disabled: false,
  140. searchShow: true,
  141. collapseTags: false,
  142. placeholder: '请点击右边按钮选择',
  143. dicData: []
  144. },
  145. }
  146. },
  147. created() {
  148. },
  149. mounted() {
  150. getUserList().then(res => {
  151. res.data.data.map((item, index) => {
  152. if (index <= 20) {
  153. this.userOption.push(item)
  154. }
  155. })
  156. })
  157. // option.height = window.innerHeight - 350 ;
  158. },
  159. methods: {
  160. value(value, row) {
  161. if (value) {
  162. row.userid = value.id
  163. row.deptid = value.deptId
  164. }
  165. },
  166. rowCell(row, index) {
  167. if (row.$cellEdit == true) {
  168. this.$set(row, "$cellEdit", false);
  169. } else {
  170. this.$set(row, "$cellEdit", true);
  171. }
  172. },
  173. //抄送
  174. copyTo() {
  175. this.formMeg = {}
  176. this.copyToDialog = true;
  177. let date = new Date();
  178. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  179. this.$set(this.formMeg, "createTime", strDate)
  180. },
  181. //用户远程模糊
  182. remoteMethod(query) {
  183. let params = {
  184. realName: query
  185. }
  186. getUserList(params).then(res => {
  187. this.userOption = res.data.data
  188. })
  189. },
  190. toUserChange(value) {
  191. this.userOption.forEach(item => {
  192. if (item.id == value) {
  193. this.formMeg.toUserName = item.realName
  194. }
  195. })
  196. },
  197. submitCopy() {
  198. this.$refs["formMeg"].validate((valid) => {
  199. if (valid) {
  200. saveMessage(this.formMeg).then(res => {
  201. if (res.data.success) {
  202. this.$message.success("抄送成功!")
  203. this.copyToDialog = false
  204. }
  205. })
  206. }
  207. })
  208. },
  209. downFile() {
  210. this.exportLoading = true
  211. let searchParams = Object.assign({}, this.search);
  212. let param = this.paramsAdjustment(searchParams)
  213. getFlowList(1, 10000, param).then(res => {
  214. const fileData = this.deepClone(res.data.data.records)
  215. fileData.map(item => {
  216. item.cornId = item.cornName
  217. })
  218. const fileColumn = this.deepClone(option.column)
  219. fileColumn.shift();
  220. this.$Export.excel({
  221. title: "任务",
  222. columns: fileColumn,
  223. data: fileData,
  224. });
  225. }).finally(() => {
  226. this.exportLoading = false
  227. })
  228. },
  229. //完工
  230. completion(row) {
  231. this.$confirm("确认将此任务完工?", {
  232. confirmButtonText: "确定",
  233. cancelButtonText: "取消",
  234. type: "warning"
  235. }).then(() => {
  236. updateItemStatus(row.id, 5).then(res => {
  237. if (res.data.success) {
  238. this.$message({
  239. type: "success",
  240. message: "操作成功!"
  241. });
  242. this.onLoad(this.page);
  243. }
  244. })
  245. });
  246. },
  247. //点击搜索按钮触发
  248. searchChange(params, done) {
  249. this.query = params;
  250. this.page.currentPage = 1;
  251. this.onLoad(this.page, params);
  252. done()
  253. },
  254. searchReset() {
  255. console.log('1')
  256. },
  257. selectionChange() {
  258. console.log('1')
  259. },
  260. currentChange(val) {
  261. this.page.currentPage = val
  262. this.onLoad(this.page)
  263. },
  264. sizeChange() {
  265. console.log('1')
  266. },
  267. refreshChange() {
  268. this.onLoad(this.page)
  269. },
  270. paramsAdjustment(params) {
  271. // params = Object.assign({}, this.search);
  272. // if (params.beginTime && params.beginTime.length != 0) { //发货
  273. // params.beginStartTime = params.beginTime[0] + " " + "00:00:00";
  274. // params.beginEndTime = params.beginTime[1] + " " + "23:59:59";
  275. // this.$delete(params, 'beginTime')
  276. // }
  277. let data = this.deepClone(Object.assign({}, params, this.search));
  278. if (data.careteTime && data.careteTime.length > 0) {
  279. data = {
  280. ...data,
  281. beginCreateTime: data.careteTime[0],
  282. endCreateTime: data.careteTime[1]
  283. };
  284. }
  285. if (!data.status) {
  286. data.status = "1,4,5";
  287. }
  288. return data
  289. },
  290. onLoad(page, params) {
  291. let data = this.paramsAdjustment(params)
  292. data.branch = 'Y';
  293. delete data.careteTime;
  294. this.loading = true;
  295. getFlowList(page.currentPage, page.pageSize, data).then(res => {
  296. this.dataList = res.data.data.records
  297. this.page.total = res.data.data.total
  298. }).finally(() => {
  299. this.loading = false
  300. })
  301. },
  302. }
  303. }
  304. </script>
  305. <style scoped>
  306. </style>