| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656 |
- <template>
- <view class="content">
- <view class="param">
- <view class="all-text">创建项目需求</view>
- <view class="proName">项目标题</view>
- <input class="proINname" v-model="pName" placeholder="请输入项目标题"/>
- <view class="proMiao">项目描述</view>
- <textarea class="proINname proIMi" v-model="projectContent" placeholder="请选择项目描述"/>
- <view class="proMiao">附件</view>
- <view class="upload-img">
- <uni-file-picker limit="3"
- @select='selectUpload'
- @delete="deleteHandle"
- :auto-upload='false'
- file-extname='pdf,docx,jpg,png,jpeg,doc,docm,dot,dotm,dotx,xlsx,xls,csv,xlsm,slxb,xlt,xltx'
- file-mediatype="all"
- @success='uploadSuccess'
- @fail='uploadFail'
- :list-styles='listStyles'
- v-model='fileList'
- ></uni-file-picker>
- </view>
- <span style="margin: 20rpx 0 0 20rpx;width: 700rpx;">支持pdf,docx,jpg,png,jpeg,doc,docm,dot,dotm,dotx,xlsx,xls,csv,xlsm,slxb,xlt,xltx格式,单个文件大小不超过5MB</span>
- <view class="proMiao">主办单位/主办人</view>
- <uni-data-picker placeholder="请选择主办单位" popup-title="请选择主办人" :localdata="range" v-model="value"
- @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
- </uni-data-picker>
- <view class="proINname" style="height: 100%;">
- <view class="tag-view" v-for="(value,key) in userListSelect1" :key="key" @click="clearTagAdmin1(value)">
- <uni-tag :text="value.parent_value.organize+'/'+value.text" type="primary" ></uni-tag>
- <!-- {{value.parent_value.organize}}/{{value.text}} -->
- <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
- </view>
- </view>
- <!-- <uni-data-select class="proINname"
- v-model="value" placeholder="请选择主办单位"
- :localdata="range"
- @change="change1"
- ></uni-data-select>
- <view class="proMiao">主办人</view>
- <uni-data-select class="proINname"
- v-model="peopleValue" placeholder="请选择主办人"
- :localdata="rangePeople"
- @change="change"
- ></uni-data-select> -->
- <view class="proMiao">协办单位/协办人</view>
- <uni-data-picker placeholder="请选择协办单位" popup-title="请选择协办人" :showSearch= "true" :localdata="range" v-model="value2"
- @change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened2" @popupclosed="onpopupclosed2">
- </uni-data-picker>
- <view class="proINname" style="height: 100%;">
- <view class="tag-view" v-for="(value,key) in userListSelect" :key="key" @click="clearTagAdmin(value)">
- <uni-tag :text="value.parent_value.organize+'/'+value.text" type="primary" ></uni-tag>
- <!-- {{value.parent_value.organize}}/{{value.text}} -->
- <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
- </view>
- </view>
- <!-- <mySelectCheckbox class="proINname" placeholder="请选择协办单位" v-model="value2" multiple dataKey="label" dataValue="value" :localdata="data"
- @change="changeXie"></mySelectCheckbox>
- <view class="proMiao">协办人</view>
- <mySelectCheckbox class="proINname" placeholder="请选择协办人" v-model="peopleValue2" multiple dataKey="label" dataValue="value" :localdata="dataPeople"
- @change="changeXiePeo"></mySelectCheckbox> -->
-
- <view class="proMiao">项目级别</view>
- <uni-data-select class="proINname"
- v-model="jibieValue" placeholder="请选择项目级别"
- :localdata="jibie"
- @change="change"
- ></uni-data-select>
- <!-- <view class="proMiao">关联流程</view>
- <uni-data-select class="proINname"
- v-model="value" placeholder="请选择关联流程"
- :localdata="range"
- @change="change"
- ></uni-data-select> -->
- <view class="proMiao">项目来源</view>
- <uni-data-select class="proINname"
- v-model="fromValue" placeholder="请选择项目来源"
- :localdata="from"
- @change="change"
- ></uni-data-select>
- <!-- <view class="proMiao jindu">完成进度</view>
- <view class="weidu">维度权重40%</view>
- <view class="addRen" @click="addRen">新增任务</view> -->
- <!-- 任务列表 -->
- <!-- <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
- <view class="renwu" v-for="(item,index) in renwu" :key="index" @click="clickRenwu">
- <view>{{item.name}}</view>
- <view>{{item.time}}</view>
- <view style="display: flex;">
- <view class="renwu-bu bianji">编辑</view>
- <view class="renwu-bu delete">删除</view>
- </view>
- </view>
- </view> -->
- <view class="proMiao">项目评分人</view>
- <uni-combox class="proINname"
- :scorePeople="scorePeople" labelKey="label" valueKey="value"
- placeholder="请选择项目评分人"
- v-model="peoplescore"
- @input="comboxInput"
- ></uni-combox>
- </uni-forms-item>
- <!-- <mySelectCheckbox class="proINname" placeholder="请选择项目评分人" v-model="peoplescore" multiple dataKey="label" dataValue="value" :localdata="scorePeople"
- @change="changeScore"></mySelectCheckbox> -->
- <view class="proINname" style="height: 100%;">
- <view class="tag-view" v-for="(value,key) in scorePeople22" :key="key" @click="clearTagAdminP(value)">
- <uni-tag :text="value" type="primary" ></uni-tag>
- <!-- {{value.parent_value.organize}}/{{value.text}} -->
- <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
- </view>
- </view>
- <view class="project">
- <view class="butt quxiao" @click="quxiao">取消</view>
- <view class="butt queren" @click="addProject">确认创建</view>
- </view>
- <view style="width: 100%;height: 60rpx;"></view>
- </view>
- </view>
- </template>
- <script>
- import configdata from '@/common/config.js'
- import mySelectCheckbox from '../../components/my-selectCheckbox.vue'
- export default {
- components:{mySelectCheckbox},
- data() {
- return {
- pName:'',//项目标题
- projectContent:'',//项目描述
- //主办单位
- value: '',
- range: [],
- userListSelect1:[],
- zhuban:[],//主办传入值数组
- zhuValue:[],//主办传入id
- //主办人
- peopleValue:'',
- rangePeople:[],
- //协办
- userListSelect:[],
- value2:'',
- data: [],
- xieban:[],//协办传入值数组
- xieValue:[],//协办传入id
- //协办人
- peopleValue2:[],
- dataPeople: [],
- xiebanPeople:[],//协办传入值数组
- xieValuePeople:[],//协办传入id
- //评分人
- peoplescore:[],
- scorePeople: [],
- scorePeople22:[],//协办传入值数组
- scoreValuePeople:[],//协办传入id
- // 项目级别
- jibieValue:0,
- jibie:[
- { value: 0, text: "正常" },
- { value: 1, text: "紧急" },
- ],
- // 项目来源
- fromValue:0,
- from:[
- { value: 0, text: "涉内" },
- { value: 1, text: "涉外" },
- ],
- fileList: [],
- fileList2: [],
- fileList22:'',
- listStyles: {
- "borderStyle": {
- "width": "0", // 边框宽度
- },
- "border": false, // 是否显示边框
- "dividline": false
- },
- renwu:[
- {name:'xxx任务',time:'2024-04-11'},
- {name:'xxx任务',time:'2024-04-11'},
- {name:'xxx任务',time:'2024-04-11'},
- ],
- }
- },
- onShow() {
- // this.getDanwei()
- this.getPeopleZhu()
- },
- methods: {
- // 主办单位
- change1(e) {
- console.log("e:", e);
- // this.getPeopleZhu(e)
-
- },
- onnodeclick(data) {
- console.log(data);
- if(data.parent_value){//存在父级
- let dataId = data.value;
- this.userListSelect1.push(data);
- this.userListSelect1 = [...new Set(this.userListSelect1)]//es6数组去重
- }
- },
- onpopupopened(e) {
- console.log('popupopened');
- },
- onpopupclosed(e) {
- console.log('popupclosed');
- },
- onchange(e) {
- console.log('---------onchange:', e);
- var acc=e.detail.value[0].text
- this.getPeople(acc)
- },
- clearTagAdmin1(value){
- this.userListSelect1 = this.userListSelect1.filter(item => item != value);
- },
- clearTagAdmin(value){
- this.userListSelect = this.userListSelect.filter(item => item != value);
- },
- onnodeclick2(data) {
- console.log(data);
- if(data.parent_value){//存在父级
- let dataId = data.value;
- this.userListSelect.push(data);
- this.userListSelect = [...new Set(this.userListSelect)]//es6数组去重
- }
- console.log('多选',this.userListSelect)
- },
- onpopupopened2(e) {
- console.log('popupopened');
- },
- onpopupclosed2(e) {
- console.log('popupclosed');
- },
- onchange2(e) {
- console.log('---------onchange:', e);
- },
- //评分人选择
- changeScore(e){
- this.scorePeople22=[]
- this.scoreValuePeople=[]
- console.log('e:', e);
- e.map(item =>{
- this.scorePeople22.push(item.label)
- this.scoreValuePeople.push(item.value)
- })
- },
- // @input combox输入事件 返回combox值
- comboxInput(e) {
- console.log('e:', e);
- // this.peoplescore=e
- // this.scorePeople22=[]
- // this.scoreValuePeople=[]
- for(var i=0;i<this.scorePeople.length;i++){
- if(e==this.scorePeople[i].value){
- this.scorePeople22.push(this.scorePeople[i].label)
- this.scoreValuePeople.push(this.scorePeople[i].value)
- }
- }
- console.log(this.scorePeople22)
- },
- clearTagAdminP(value){
- this.scorePeople22 = this.scorePeople22.filter(item => item != value);
- },
- //获取单位
- getDanwei(){
- this.range=[]
- this.data=[]
- uni.showLoading({
- title: '加载中',
- mask: true, // 是否显示透明蒙层,防止触摸穿透
- });
- this.$Request.postT('/api/Organize/query').then(res => {
- if (res.code==200&&res.data) {
- // this.range =res.data.map(item =>{
- // return {
- // value: item.id,
- // text: item.oname,
- // }
- // })
- this.data =res.data.map(item =>{
- return {
- value: item.id,
- label: item.oname,
- }
- })
- console.log(this.range)
- }
- uni.hideLoading();
- });
- },
- //获取主办协办人,评分人
- getPeopleZhu(){
- this.range=[]
- this.rangePeople=[]
- uni.showLoading({
- title: '加载中',
- mask: true, // 是否显示透明蒙层,防止触摸穿透
- });
- this.$Request.postJson('/api/sysProject/queryCoUsers',{}).then(res => {
- if (res.code==200) {
- var lianji=[]
- for(var i=0;i<res.data.length;i++){
- if(res.data[i].userList.length>0){
- lianji.push(res.data[i])
- }
- }
- this.range =lianji.map(item =>{
- return {
- value: item,
- text: item.organize,
- children:item.userList.map(item =>{
- return{
- value: item.id,
- text: item.userName,
- }
- })
- }
- })
- console.log(this.range,'人')
- }else{
- var ii=JSON.stringify(res)
- console.log(res,res.data)
- console.log(JSON.parse(res))
- console.log(JSON.parse(ii))
- }
- uni.hideLoading();
- });
- },
- //根据单位获取人员(评分人)
- getPeople(acc){
- console.log(this.userListSelect1)
- this.scorePeople=[]
- uni.showLoading({
- title: '加载中',
- mask: true, // 是否显示透明蒙层,防止触摸穿透
- });
- this.$Request.postT('/api/sysUser/queryScorer',{
- organizes:acc
- }).then(res => {
- if (res.code==200) {
- console.log(res,'评分')
- this.scorePeople =res.data.map(item =>{
- return {
- value: item.id,
- label: item.userName,
- }
- })
- console.log(this.scorePeople,'人')
- }else{
- var ii=JSON.stringify(res)
- console.log(res,res.data)
- console.log(JSON.parse(res))
- console.log(JSON.parse(ii))
- }
- uni.hideLoading();
- });
- },
- //取消
- quxiao(){
- uni.switchTab({
- url:'/pages/project/index'
- })
- },
- //新增项目
- addProject(){
- console.log('协办',this.userListSelect1,this.value2,this.userListSelect)
- console.log('评分人',this.scoreValuePeople)
- console.log(this.jibie[this.jibieValue].text)
- var zhuban=[]
- var zhubanValue=[]
- this.userListSelect1.map(item =>{
- zhuban.push(item.parent_value.organize)
- zhubanValue.push(item.value)
- })
- console.log(zhuban,zhubanValue)
- if(this.userListSelect==[]){
- var xie=null
- var xieValue=null
- }else {
- var xieban=[]
- var xiebanValue=[]
- this.userListSelect.map(item =>{
- xieban.push(item.parent_value.organize)
- xiebanValue.push(item.value)
- })
- console.log(xieban,xiebanValue)
- var xie=xieban.join(",")
- var xieValue=xiebanValue.join(",")
- }
-
- let that = this
- if (!that.pName) {
- that.$queue.showToast("请输入项目标题");
- }else if (!that.projectContent) {
- that.$queue.showToast("请输入项目描述");
- }else {
- uni.showLoading({
- title: '加载中',
- mask: true, // 是否显示透明蒙层,防止触摸穿透
- });
- var data={
- "projectName": that.pName, // 项目名称
- "projectFrom": that.from[that.fromValue].text, // 项目来源
- "projectLevel": that.jibie[that.jibieValue].text, // 项目等级
- "projectContent": that.projectContent, // 项目描述
- "fileUrl": that.fileList22, // 附件
- "organize": zhuban.join(","), // 主办单位-多选
- "sposoner": zhubanValue.join(","), // 主办人ID-多选
- "coOrganize": xie, // 协办单位-多选
- "coSposoner": xieValue, // 协办人ID-多选
- "scorer": that.scoreValuePeople.join(",") // 评分人ID-多选
- }
- that.$Request.postJson('/api/sysProject/add',data).then(res => {
- if (res.code==200) {
- uni.showToast({
- title: '添加成功',
- icon: 'none',
- duration:800
- });
- uni.hideLoading()
-
- setTimeout(function() {
- uni.switchTab({
- url:'/pages/project/index'
- })
- }, 1000)
- } else {
- uni.hideLoading();
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration:800
- });
- }
- });
- }
- },
- //新增任务
- addRen(){
- uni.navigateTo({
- url:'/pages/project/addRenwu'
- })
- },
- //任务详情
- clickRenwu(){
- uni.navigateTo({
- url:'/pages/project/renwuX'
- })
- },
- // 上传附件
- uploadSuccess(e) {
- console.log('上传成功', e)
- },
- uploadFail(e) {
- console.log('上传失败:', e)
- },
- //删除文件
- deleteHandle(index){
- console.log(index)
- this.fileList2.splice(index.index,1)
- // console.log(this.fileList2)
- this.fileList22=this.fileList2.join(",")
- },
- async selectUpload(e) {
- console.log('上传:', e)
- let data = new FormData();
- data.set("file", e.tempFiles[0].file);
- let res = await this.$axios({
- method: "post",
- url: this.config('APIHOST1') + "/api/sysFile/upload",
- headers: {
- tokenW: sessionStorage.getItem("token"),
- "Content-Type": "multipart/form-data"
- },
- data: data,
- });
- // return res
- console.log(res, "图片上传成功");
- if (res.data.code == 200) {
- console.log(this.fileList)
- this.fileList2.push(res.data.data);
- this.fileList22=this.fileList2.join(",")
- // console.log(this.fileList2.join(","))
- } else if(res.message=="登录凭证已过去,请重新登录"){
- sessionStorage.removeItem("token")
- sessionStorage.removeItem("roleId")
- uni.showModal({
- title: '提示',
- content: '用户信息失效,请重新登录!',
- showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
- success: function(res) {
- if (res.confirm) {
- }
- }
- });
- }else {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration:800
- });
- }
- },
- config: function (name) {
- var info = null
- if (name) {
- var name2 = name.split('.') //字符分割
- if (name2.length > 1) {
- info = configdata[name2[0]][name2[1]] || null
- } else {
- info = configdata[name] || null
- }
- if (info == null) {
- let web_config = cache.get('web_config')
- if (web_config) {
- if (name2.length > 1) {
- info = web_config[name2[0]][name2[1]] || null
- } else {
- info = web_config[name] || null
- }
- }
- }
- }
- return info
- },
- }
- }
- </script>
- <style>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .param{
- margin: 20rpx 0 0 0;
- width: 100%;
- background-color: rgba(255, 255, 255, 1);
- font-size: 28rpx;
- font-weight: 400;
- line-height: 41rpx;
- color: rgba(0, 0, 0, 1);
- }
- .all-text{
- margin: 22rpx 0 0 20rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: rgba(0, 0, 0, 1);
- }
- .proName{
- margin: 23rpx 0 0 20rpx;
- }
- .proINname{
- margin: 25rpx 0 0 21rpx;
- width: 709rpx;
- height: 90rpx;
- border-radius: 13rpx;
- background: rgba(245, 248, 252, 1);
- border: 1rpx solid rgba(229, 229, 229, 1);
- font-size: 28rpx;
- line-height: 90rpx;
- /* color: rgba(179, 179, 179, 1); */
- }
- .proIMi{
- height: 315rpx;
- }
- .proMiao{
- margin: 31rpx 0 0 20rpx;
- }
- /* 上传附件 */
- .upload-img{
- /* margin: 25rpx 0 0 21rpx;
- width: 200rpx;
- opacity: 1;
- border-radius: 13rpx;
- background: rgba(0, 97, 255, 0.1);
-
- border: 1rpx solid rgba(0, 97, 255, 1); */
- }
- .jindu{
- font-size: 32rpx;
- font-weight: 500;
- line-height: 46rpx;
- }
- .weidu{
- margin: 7rpx 0 0 20rpx;
- font-size: 24rpx;
- line-height: 35rpx;
- color: rgba(128, 128, 128, 1);
- }
- .addRen{
- margin: -80rpx 0 0 581rpx;
- width: 149rpx;
- height: 59rpx;
- border-radius: 92rpx;
- background: rgba(0, 97, 255, 1);
- font-size: 28rpx;
- line-height: 59rpx;
- color: rgba(255, 255, 255, 1);
- text-align: center;
- }
- /* 任务列表 */
- .renwu{
- display: flex;
- margin-top: 6rpx;
- width: 709rpx;
- height: 90rpx;
- border-radius: 13rpx;
- background: rgba(245, 248, 252, 1);
- border: 1rpx solid rgba(229, 229, 229, 1);
- font-size: 28rpx;
- justify-content: space-evenly;
- align-items: center;
- }
- .renwu-bu{
- width: 105rpx;
- height: 50rpx;
- border-radius: 110rpx;
- line-height:50rpx;
- text-align: center;
- }
- .bianji{
- border: 1rpx solid rgba(0, 97, 255, 1);
- color: rgba(0, 97, 255, 1);
- }
- .delete{
- margin-left: 20rpx;
- border: 1rpx solid rgba(212, 48, 48, 1);
- color: rgba(212, 48, 48, 1);
- }
- .project{
- display: flex;
- margin: 61rpx 0 0 0;
- justify-content: space-evenly;
- }
- .butt{
- width: 330rpx;
- height: 90rpx;
- border-radius: 117rpx;
- font-size: 32rpx;
- line-height: 90rpx;
- text-align: center;
- }
- .quxiao{
- border: 1rpx solid rgba(0, 97, 255, 1);
- color: rgba(0, 97, 255, 1);
- }
- .queren{
- background: rgba(0, 97, 255, 1);
- color: rgba(255, 255, 255, 1);
- }
- </style>
|