scheduleAdd.vue 11 KB

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