scheduleAdd.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <!--
  2. * @Descripttion: 首页-日程日历编辑框
  3. * @version: 1.0
  4. * @Author: Liu_jiaYin
  5. * @Date: 2024-04-01 15:45:58
  6. * @LastEditors: Do not edit
  7. * @LastEditTime: 2024-04-08 13:33:37
  8. -->
  9. <template>
  10. <!-- 弹窗部分 -->
  11. <el-dialog
  12. ref="dialogRef"
  13. :title="optTitle"
  14. :visible.sync="calendarVisible"
  15. :show-close="false"
  16. :close-on-click-modal="false"
  17. append-to-body
  18. >
  19. <el-form
  20. ref="form"
  21. :model="calendarForm"
  22. :rules="rules"
  23. label-width="82px"
  24. label-height="500px"
  25. >
  26. <el-col :span="6">
  27. <el-tree
  28. class="tree"
  29. :data="form.eventTrees"
  30. node-key="id"
  31. :props="defaultProps"
  32. @node-click="handleNodeClick"
  33. >
  34. <!-- eslint-disable-next-line -->
  35. <span class="span-ellipsis" slot-scope="{ node, data }">
  36. <span :title="node.label">{{
  37. getTitle(node.label)
  38. }}</span>
  39. </span>
  40. </el-tree>
  41. </el-col>
  42. <el-col :span="16">
  43. <el-form-item label="事件标题:" prop="biaoTi">
  44. <el-input
  45. v-model="calendarForm.biaoTi"
  46. placeholder="请输入事件标题"
  47. clearable
  48. />
  49. </el-form-item>
  50. <el-form-item label="事件内容:" prop="neiRong">
  51. <el-input
  52. v-model="calendarForm.neiRong"
  53. type="textarea"
  54. :autosize="{ minRows: 5, maxRows: 10}"
  55. placeholder="请输入事件内容"
  56. clearable
  57. />
  58. </el-form-item>
  59. <el-form-item label="选择时间:" prop="formDate">
  60. <el-date-picker
  61. v-model="calendarForm.formDate"
  62. type="daterange"
  63. style="width: 100%"
  64. align="right"
  65. unlink-panels
  66. range-separator="至"
  67. start-placeholder="开始日期"
  68. end-placeholder="结束日期"
  69. :picker-options="pickerOptions"
  70. value-format="yyyy-MM-dd"
  71. />
  72. </el-form-item>
  73. <el-form-item label="紧急状态:" prop="zhuangTai">
  74. <el-radio-group
  75. v-model="calendarForm.zhuangTai"
  76. size="small"
  77. >
  78. <el-radio label="1" border class="class1">急</el-radio>
  79. <el-radio label="2" border class="class2">重</el-radio>
  80. <el-radio label="3" border class="class3">轻</el-radio>
  81. <el-radio label="4" border class="class4">缓</el-radio>
  82. </el-radio-group>
  83. </el-form-item>
  84. </el-col>
  85. </el-form>
  86. <div slot="footer" class="dialog-footer">
  87. <el-button plain @click="clear">清 空</el-button>
  88. <el-button type="success" plain @click="saveAndAdd">保存并新增</el-button>
  89. <el-button type="primary" plain @click="saveEvent">保 存</el-button>
  90. <el-button type="danger" plain @click="delEvent">删 除</el-button>
  91. <el-button style="float: rihgt" plain @click="closeDialog">关 闭</el-button>
  92. </div>
  93. </el-dialog>
  94. </template>
  95. <script>
  96. import UtilUtils from '@/utils/util'
  97. export default {
  98. components: {},
  99. props: {
  100. visible: {
  101. type: Boolean,
  102. default: false
  103. },
  104. form: {
  105. type: Object,
  106. default: () => {}
  107. }
  108. },
  109. data () {
  110. return {
  111. optTitle: '日程',
  112. rules: {
  113. biaoTi: [
  114. { required: true, message: this.$t('validate.required') },
  115. {
  116. min: 1,
  117. max: 200,
  118. message: '长度不能超过200个字符',
  119. trigger: 'blur'
  120. }
  121. ],
  122. neiRong: [
  123. {
  124. min: 1,
  125. max: 2000,
  126. message: '长度不能超过2000个字符',
  127. trigger: 'blur'
  128. }
  129. ],
  130. formDate: [
  131. { required: true, message: this.$t('validate.required') }
  132. ],
  133. zhuangTai: [
  134. { required: true, message: this.$t('validate.required') }
  135. ]
  136. },
  137. pickerOptions: {
  138. shortcuts: [
  139. {
  140. text: '最近一周',
  141. onClick (picker) {
  142. const end = new Date()
  143. const start = new Date()
  144. start.setTime(
  145. start.getTime() - 3600 * 1000 * 24 * 7
  146. )
  147. picker.$emit('pick', [start, end])
  148. }
  149. },
  150. {
  151. text: '最近一个月',
  152. onClick (picker) {
  153. const end = new Date()
  154. const start = new Date()
  155. start.setTime(
  156. start.getTime() - 3600 * 1000 * 24 * 30
  157. )
  158. picker.$emit('pick', [start, end])
  159. }
  160. },
  161. {
  162. text: '最近三个月',
  163. onClick (picker) {
  164. const end = new Date()
  165. const start = new Date()
  166. start.setTime(
  167. start.getTime() - 3600 * 1000 * 24 * 90
  168. )
  169. picker.$emit('pick', [start, end])
  170. }
  171. }
  172. ]
  173. },
  174. data2: [],
  175. calendarVisible: false,
  176. defaultProps: {
  177. children: 'children',
  178. label: 'label'
  179. },
  180. calendarForm: {}
  181. }
  182. },
  183. watch: {
  184. visible: {
  185. handler: function (val, oldVal) {
  186. this.calendarVisible = this.visible
  187. },
  188. immediate: true
  189. },
  190. form: {
  191. handler: function (val, oldVal) {
  192. if (!UtilUtils.isEmptyObject(val)) {
  193. const obj = val.eventTrees.find(fid => { return fid.id === val.clickId })
  194. if (val.eventTrees.length && !UtilUtils.isEmptyObject(obj) && obj !== undefined) {
  195. this.calendarForm = {
  196. id: obj.id,
  197. biaoTi: obj.title,
  198. neiRong: obj.content,
  199. formDate: [obj.start, obj.jieShuShiJian],
  200. zhuangTai: obj.zhuangTai
  201. }
  202. } else {
  203. this.calendarForm = {
  204. id: '',
  205. biaoTi: '',
  206. neiRong: '',
  207. formDate: [val.clickedDate, val.clickedDate],
  208. zhuangTai: ''
  209. }
  210. }
  211. }
  212. },
  213. immediate: true
  214. }
  215. },
  216. methods: {
  217. clear () {
  218. this.calendarForm = {
  219. id: '',
  220. biaoTi: '',
  221. neiRong: '',
  222. formDate: [],
  223. zhuangTai: ''
  224. }
  225. },
  226. saveAndAdd () {
  227. this.$refs.form.validate((valid) => {
  228. if (valid) {
  229. this.calendarForm.id = ''
  230. this.$emit('saveData', {
  231. state: 'calendar',
  232. form: this.calendarForm
  233. })
  234. this.closeDialog()
  235. }
  236. })
  237. },
  238. saveEvent () {
  239. this.$refs.form.validate((valid) => {
  240. if (valid) {
  241. this.$emit('saveData', {
  242. state: 'calendar',
  243. form: this.calendarForm
  244. })
  245. this.closeDialog()
  246. }
  247. })
  248. },
  249. delEvent (v) {
  250. this.$emit('delData', {
  251. state: 'calendar',
  252. form: this.calendarForm
  253. })
  254. this.closeDialog()
  255. },
  256. // /* 清空*/
  257. // daloginEmpty() {
  258. // this.calendarForm.id = "";
  259. // },
  260. handleNodeClick (v) {
  261. this.calendarForm = {
  262. id: v.id,
  263. biaoTi: v.title,
  264. neiRong: v.content,
  265. formDate: [v.start, v.jieShuShiJian],
  266. zhuangTai: v.zhuangTai
  267. }
  268. },
  269. closeDialog () {
  270. this.$emit('close', 'calendar')
  271. },
  272. getTitle (str) {
  273. if (str.length > 9) {
  274. return str.substring(0, 9) + '...'
  275. } else {
  276. return str
  277. }
  278. }
  279. }
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. @import "~@/assets/styles/public.scss";
  284. .ibps-desktop-page {
  285. .ibps-container-frame {
  286. position: absolute;
  287. top: 0px;
  288. left: 0px;
  289. height: 100%;
  290. width: 100%;
  291. }
  292. .ibps-grid-item,
  293. .el-card {
  294. height: 100%;
  295. }
  296. .vue-grid-layout {
  297. border-radius: 4px;
  298. // margin: -10px;
  299. .page_card {
  300. height: 100%;
  301. @extend %unable-select;
  302. }
  303. .vue-resizable-handle {
  304. opacity: 0.3;
  305. &:hover {
  306. opacity: 1;
  307. }
  308. }
  309. }
  310. }
  311. .tree {
  312. .el-tree-node__content > .el-tree-node__expand-icon {
  313. padding: 0px;
  314. }
  315. max-height: 500px;
  316. overflow: auto;
  317. }
  318. </style>
  319. <style lang="scss">
  320. .class1{
  321. .el-radio__input.is-checked + .el-radio__label {
  322. color: #e7505a !important;
  323. }
  324. }
  325. .class2{
  326. .el-radio__input.is-checked + .el-radio__label {
  327. color: #f3c200 !important;
  328. }
  329. }
  330. .class3{
  331. .el-radio__input.is-checked + .el-radio__label {
  332. color: #578ebe !important;
  333. }
  334. }
  335. .class4{
  336. .el-radio__input.is-checked + .el-radio__label {
  337. color: #1BBC9B !important;
  338. }
  339. }
  340. </style>